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

Support for netbox 4.x #176

Open
dBitech opened this issue May 11, 2024 · 103 comments
Open

Support for netbox 4.x #176

dBitech opened this issue May 11, 2024 · 103 comments
Assignees
Labels
accepted This issue has been accepted for implementation

Comments

@dBitech
Copy link

dBitech commented May 11, 2024

There were changes in netbox 3.7 which were further deprecated in 4.0 Please see Migrating Your Plugin to NetBox v4.0 for porting instructions to make the plugin compatible with 4.x

@xXAzazelXx
Copy link

xXAzazelXx commented Jul 21, 2024

Yep it's broken at the moment.
ModuleNotFoundError: No module named 'extras.plugins'

@OberMarcLP
Copy link

Can I do something to fix it, or must I wait until a new Version of Proxbox is coming out?

@Tehniels2000

This comment was marked as duplicate.

@Uzoma8Chi
Copy link
Contributor

Why do you not make a new release for 4.x? I already see commit.
de2bb66c78be3cf8d20c93afd2f0e3c5ed6b3d9c\
Since I use docker I do not know how to use non released changes.

@fibretel
Copy link

Why do you not make a new release for 4.x? I already see commit. [de2bb66](https://github.com/netdevopsbr/netbox-proxbox/commit/de2bb66c78be3cf8d20c93afd2f0e3c5ed6b3d9c) Since I use docker I do not know how to use non released changes.

The github version installs on 4.x, but it still doesn't seem to work on the latest netbox release

@psiess
Copy link

psiess commented Sep 19, 2024

I'm having the same problem with Netbox 4.1.1. When trying to run python3 manage.py migrate I get the same errors as @Tehniels2000.

Any ETA for a fix for this problem?

@emersonfelipesp
Copy link
Member

Currently working on support for latest Netbox version.

@psiess
Copy link

psiess commented Sep 25, 2024

Currently working on support for latest Netbox version.

Excellent. Thank you for the letting us know.

@maxdallmair
Copy link

Hello, sorry to push this, but is there any ETA?

@emersonfelipesp
Copy link
Member

Currently working on it, on my test env everything is going fine. You guys can already test it. But I'm improving testing and corner cases, as it's not easy to predict all Proxmox environments.

@emersonfelipesp emersonfelipesp added accepted This issue has been accepted for implementation under review Further discussion is needed to determine this issue's scope and/or implementation labels Oct 11, 2024
@emersonfelipesp emersonfelipesp self-assigned this Oct 11, 2024
@emersonfelipesp emersonfelipesp pinned this issue Oct 11, 2024
@emersonfelipesp
Copy link
Member

I would like to also note that although I love the project and its function, I do it as best-effort and have no return. I'm really glad the amount of people that use it, but I ask for some patience, if possible.

@psiess
Copy link

psiess commented Oct 17, 2024 via email

@spacecodeit
Copy link

Hello,
I tried to install the current develop branch version but I get the following error:

The complete exception is provided below:

<class 'KeyError'>

'fastapi'

Python version: 3.11.2
NetBox version: 4.1.4
Plugins: 
  netbox_proxbox: 0.0.5

But based on pip list fastapi is installed fastapi 0.115.2.

Do you have any Ideas what I'm doing wrong?

@emersonfelipesp
Copy link
Member

Hi @spacecodeit could you please the last commits and confirm that fastapi is installed on Netbox Virtual Venv (/opt/netbox/venv)?

Also, now on Proxbox plugin homepage, there is connection status to the services and log messages on the bottom, as you click on Proxmox Full Update button. Send me the output log messages, if possible.

@emersonfelipesp
Copy link
Member

emersonfelipesp commented Oct 18, 2024

Hi @psiess, you just need to pull the develop (using git checkout develop) branch and you're fine. I'm currently working on it, but plugin should work.

@psiess
Copy link

psiess commented Oct 18, 2024

Hi @psiess, you just need to pull the develop (using git checkout develop) branch and you're fine. I'm currently working on it, but plugin should work.

Sorry for the newbie question. How do I pull the develop branch? I cloned the repository and can see the branches

git branch -a

  • develop
    remotes/origin/HEAD -> origin/develop
    remotes/origin/auto-update
    remotes/origin/backend
    remotes/origin/develop
    remotes/origin/gh-pages
    remotes/origin/main
    remotes/origin/optimize-performance
    remotes/origin/proxmox-folder-view

...but I can't figure out how to pull the develop branch. I tried git clone develop and git pull develop but neither work.

@emersonfelipesp
Copy link
Member

I think you already switched to develop.
If not, just issue the git checkout develop command and then git branch to check if it worked.

@psiess
Copy link

psiess commented Oct 18, 2024

You are right @emersonfelipesp. I was able to install netbox-proxbox, but get an error right at the end of the installation:

Installed /opt/netbox/venv/lib/python3.12/site-packages/fastapi_cli-0.0.5-py3.12.egg
error: starlette 0.41.0 is installed but starlette<0.41.0,>=0.37.2 is required by {'fastapi'}

Can I downgrade starlette without messing up the rest of netbox? Or install a lower version alongside the 0.41.0?

@emersonfelipesp
Copy link
Member

emersonfelipesp commented Oct 18, 2024

I'm currently using starlette=0.38.6

Yo can try this version with: pip install -Iv starlette=0.38.6

@emersonfelipesp
Copy link
Member

emersonfelipesp commented Oct 18, 2024

@psiess try using the git pull again to get my last commits. I have added/changed:

Let me now if it works!

@emersonfelipesp
Copy link
Member

emersonfelipesp commented Oct 18, 2024

I actually had to use starlette==0.40.0 as Github pointed out the previous version had a major security issue.
Just tested 0.40.0 version and apparently looks good.

@psiess
Copy link

psiess commented Oct 18, 2024

Do I need to re-install after the new pull?

@emersonfelipesp
Copy link
Member

@psiess I'm not sure, but would be good.

@troycarpenter
Copy link

I also want to be sure I'm doing this right. I currently go into /opt/netbox/netbox/netbox-proxbox and do a git pull to get the latest. Then, in /opt/netbox I execute ./update.sh with netbox-proxbox in the local_requirements file.

I'm not sure it's working because Netbox doesn't start with the plugin activated. If I remove netbox_proxbox from the configuration.py file that Netbox will start.

Is there a different way I should be doing that?

@emersonfelipesp
Copy link
Member

Hi @troycarpenter, could you se Netbox logs? I don't get why it didn't work. I'm putting a lot of effort on Docs and Proxbox Plugin GUI so that User knows exactly what is going on. But for now, I'll need some help from you guys to find the bugs.

@troycarpenter
Copy link

I have tried all the ways I've found online to get Netbox to log to a file, but nothing has worked for me. It's gone as far as creating the log file, but nothing is ever logged there. In configuration.py, I have this:

DEBUG = True
import logging.handlers
LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'formatters': {
        'normal': {
            'format': '%(asctime)s %(name)s %(levelname)s: %(message)s'
        },
    },
    'handlers': {
        'file': {
            'level': 'DEBUG',
            'class': 'logging.handlers.WatchedFileHandler',
            'filename': '/var/log/netbox/netbox.log',
            'formatter': 'normal',
        },
        'console': {
            'class': 'logging.StreamHandler',
        },
    },
    'root': {
        'handlers': ['console'],
        'level': 'INFO',
    },
    'loggers': {
        'django': {
            'handlers': ['file'],
            'level': 'INFO',
        },
        'netbox': {
            'handlers': ['file'],
            'level': 'INFO',
        },
    },
}

That logging section is now a frankenstien based on a few websites.

@andyfsimon
Copy link

I know I am late to this party, but I am also a bit stuck. I have an almost fresh 4.1.6 install of Netbox and I am trying to install proxbox but failing. Not a git installation: I downloaded the tar.gz.
I manage to install it and run the update, but then when I run the python3 manage.py migrate I get:

File "/opt/netbox-4.1.6/venv/lib64/python3.12/site-packages/netbox_proxbox/__init__.py", line 2, in <module> from extras.plugins import PluginConfig ModuleNotFoundError: No module named 'extras.plugins'
I am probably doing something wrong, because here I see people going well further - what am I missing?

@psiess
Copy link

psiess commented Nov 19, 2024

I'm running into a versioning problem when attempting to run python3 setup.py develop. Here is the error:

error: httpcore 1.0.7 is installed but httpcore<0.14.0,>=0.13.3 is required by {'httpx'}

Environment:
Ubuntu 24.04.1 LTS
Python 3.12.3
pip 24.0
Netbox 4.1.6

@hoyohayo
Copy link

I'm running into a versioning problem when attempting to run python3 setup.py develop. Here is the error:

error: httpcore 1.0.7 is installed but httpcore<0.14.0,>=0.13.3 is required by {'httpx'}

Environment: Ubuntu 24.04.1 LTS Python 3.12.3 pip 24.0 Netbox 4.1.6

This should do it:
#176 (comment)

@psiess
Copy link

psiess commented Nov 19, 2024

Thank @hoyohayo. I made the change and now I have a different error: error: httpcore 0.13.7 is installed but httpcore==1.* is required by {'httpx'}

How httpcore version changed is beyond me. I didn't touch it. Any suggestions?

@psiess
Copy link

psiess commented Nov 19, 2024

Thank @hoyohayo. I made the change and now I have a different error: error: httpcore 0.13.7 is installed but httpcore==1.* is required by {'httpx'}

How httpcore version changed is beyond me. I didn't touch it. Any suggestions?

Nevermind. I got past that problem. Working on configuration.py settings now.

@mgob
Copy link

mgob commented Nov 21, 2024

I'm basically in the same boat here ( with the exception the netbox status API is fine for me ), everything works when hitting the Proxbox FastAPI directly, just not via the GUI. :)
Also I'm running in Docker successfully to that point, which is awesome.

Let me refine my observations:

  1. From the Netbox GUI, when I hit "Proxmox Full Update", nothing seems to happen. No log output.
  2. Using the Proxbox backend web interface, I executed /proxmox/cluster/status API and I got a log about proxbox logging into Proxmox and the URL. I see expected output in the web interface.
  3. Executing /proxbox/netbox/plugins-config API, I get log output about the API call, and the web interface as expected results.
  4. Executing /netbox/status API gives me the connection refused log (with lots of other traceback info), and the web interface shows "Internal Error".

So the login error in no. 4 concerns me, I just can't figure out what I'm missing for the token login. But the lack of log output when I hit "Proxmox Full Update" seems like it's not even trying from the Netbox Web GUI.
I was able to fix the Netbox login problem by switching the netbox host back to "localhost".
However, still nothing happens when I try to do the full update from the Netbox interface, nothing seems to happen and no logs are printed.

Hi @mgob! Let me understand, on your environment, Proxbox Backend is communicating with Netbox API and you are using the FastAPI routes directly? If so, can you send me how it shows to you on GUI? (sending me exampel imagems, prints, et cetera.)

@emersonfelipesp I'm showing the same result as others in the web GUI. The GUI for me reports no errors, but also provides no actionable data.

When the FastAPI was not connecting I was getting the big red bar alerting as such, as soon as that was resolved it went away but, still no updates in the GUI.

From the CLI I get good data if I curl directly;

unit@4eed0ca6b191:/opt/netbox/netbox$ curl http://netbox-proxbox:8800
{"message":"Proxbox Backend made in FastAPI framework","proxbox":{"github":"https://github.com/netdevopsbr/netbox-proxbox","docs":"https://docs.netbox.dev.br"},"fastapi":{"github":"https://github.com/tiangolo/fastapi","website":"https://fastapi.tiangolo.com/","reason":"FastAPI was chosen because of performance and reliabilty."}}
unit@4eed0ca6b191:/opt/netbox/netbox$ curl http://netbox-proxbox:8800/proxmox/cluster/status
[{"rmg":[{"version":4,"quorate":1,"id":"cluster","nodes":3,"type":"cluster","name":"rmg"},{"online":1,"id":"node/mycoolclustername1","local":0,"ip":"172.16.49.172","name":"mycoolclustername","level":"b","nodeid":2,"type":"node"},{"online":1,"id":"node/mycoolclustername2","local":1,"ip":"172.16.49.173","nodeid":3,"level":"b","type":"node","name":"mycoolclustername2"},{"name":"mycoolclustername3","nodeid":1,"level":"b","type":"node","id":"node/mycoolclustername3","ip":"172.16.49.171","local":0,"online":1}]}]

So fastAPI has access, but the GUI shows unknown;

Screenshot 2024-11-21 at 11 00 52 AM

@emersonfelipesp
Copy link
Member

Hi @mgob could you please send me the full screen print of your GUI page?

image

On this example, all the RED fields are from static configuration located at Netbox configuration.py. As for the BLUE ones, it is filled by the Proxbox API, if any of those fields are empty, it means the communication failed.

I also would like to now if at the bottom of the page, is there any log messages showing, like this:

image

@ctothelew
Copy link

ctothelew commented Nov 22, 2024

I would also appreciate if anyone seeing this thread comment if succeeded on using Proxbox in Netbox v4.

I've spent the last day and a half attempting to get this working on 4.1.6, most of the issues I've had have revolved around untrusted connections between my https enabled netbox and fastapi. I did have an issue with a missing init.py file in the backend/enum folder that was causing the service to fail out due to a missing module. I use an nginx proxy as a frontend for our proxmox clusters, so I was able to route through that for the host to make https work. I got a letsencrypt cert for uvicorn and have modified the home.html file to change the connections to ssl and have been able to get it to load properly.

I'm using an fqdn for the fastapi connection, so SSL works and all connections show as Successful. When I do a Full Update, it creates a cluster, but then just stops. If I click Full Update again, I get a "Websocket is already in CLOSING or CLOSED state" in a chrome console
proxbox

EDIT: I apparently spoke too soon. After reloading proxbox and netbox...again...doing a full update has given me this

Getting Cluster Type from Netbox.
Cluster Type found on Netbox. Checking if it's 'Proxbox' one...
The Cluster Type object found IS NOT from 'Proxbox'. Creating a default one.
Creating DEFAULT Cluster Type object on Netbox.
Checking if Cluster Type exists on Netbox before creating it.
Checking default object.
Cluster Type object already exists on Netbox. Returning it.
Getting Cluster from Netbox.
Searching Cluster by kwargs {'name': 'ptg-pm-int'}.
Creating Device ptg-pm1-a related with the Virtual Machine(s)
Error trying to create Netbox Device object.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to search bridge child interface.
Creating child interface of a bridge. Bridge interface and child must belong to the same device.
Error trying to create Netbox interface.
Error trying to search bridge child interface.
Creating child interface of a bridge. Bridge interface and child must belong to the same device.
Error trying to create Netbox interface.
Creating Device ptg-pm1-c related with the Virtual Machine(s)
Error trying to create Netbox Device object.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to search bridge child interface.
Creating child interface of a bridge. Bridge interface and child must belong to the same device.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to search bridge child interface.
Creating child interface of a bridge. Bridge interface and child must belong to the same device.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Creating Device ptg-pm1-d related with the Virtual Machine(s)
Error trying to create Netbox Device object.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to search bridge child interface.
Creating child interface of a bridge. Bridge interface and child must belong to the same device.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to search bridge child interface.
Creating child interface of a bridge. Bridge interface and child must belong to the same device.
Creating Device ptg-pm1-b related with the Virtual Machine(s)
Error trying to create Netbox Device object.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to search bridge child interface.
Creating child interface of a bridge. Bridge interface and child must belong to the same device.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to search bridge child interface.
Creating child interface of a bridge. Bridge interface and child must belong to the same device.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Nodes: []
Getting Cluster from Netbox.
Searching Cluster by kwargs {'name': 'PTG-PM1-EXT'}.
Creating Device ptg-pm1-ext-b related with the Virtual Machine(s)
Error trying to create Netbox Device object.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to search bridge child interface.
Creating child interface of a bridge. Bridge interface and child must belong to the same device.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to search bridge child interface.
Creating child interface of a bridge. Bridge interface and child must belong to the same device.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Creating Device ptg-pm1-ext-d related with the Virtual Machine(s)
Error trying to create Netbox Device object.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to search bridge child interface.
Creating child interface of a bridge. Bridge interface and child must belong to the same device.
Error trying to create Netbox interface.
Error trying to search bridge child interface.
Creating child interface of a bridge. Bridge interface and child must belong to the same device.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Creating Device ptg-pm1-ext-c related with the Virtual Machine(s)
Error trying to create Netbox Device object.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to search bridge child interface.
Creating child interface of a bridge. Bridge interface and child must belong to the same device.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to search bridge child interface.
Creating child interface of a bridge. Bridge interface and child must belong to the same device.
Error trying to create Netbox interface.
Creating Device ptg-pm1-ext-a related with the Virtual Machine(s)
Error trying to create Netbox Device object.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to search bridge child interface.
Creating child interface of a bridge. Bridge interface and child must belong to the same device.
Error trying to create Netbox interface.
Error trying to search bridge child interface.
Creating child interface of a bridge. Bridge interface and child must belong to the same device.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Nodes: []
Getting Site from Netbox.
Site found on Netbox. Checking if it's 'Proxbox' one...
The Site found is from 'Proxbox' (because it has the tag). Returning it.
Getting Device Types from Netbox.
Device Types found on Netbox. Checking if it's 'Proxbox' one...
The Device Types found is from 'Proxbox' (because it has the tag). Returning it.
Getting Manufacturer from Netbox.
Manufacturer found on Netbox. Checking if it's 'Proxbox' one...
The Manufacturer found is from 'Proxbox' (because it has the tag). Returning it.

Then it stops. So it does create a cluster-type, but nothing else after that.

@emersonfelipesp
Copy link
Member

emersonfelipesp commented Nov 23, 2024

I would also appreciate if anyone seeing this thread comment if succeeded on using Proxbox in Netbox v4.

I've spent the last day and a half attempting to get this working on 4.1.6, most of the issues I've had have revolved around untrusted connections between my https enabled netbox and fastapi. I did have an issue with a missing init.py file in the backend/enum folder that was causing the service to fail out due to a missing module. I use an nginx proxy as a frontend for our proxmox clusters, so I was able to route through that for the host to make https work. I got a letsencrypt cert for uvicorn and have modified the home.html file to change the connections to ssl and have been able to get it to load properly.

I'm using an fqdn for the fastapi connection, so SSL works and all connections show as Successful. When I do a Full Update, it creates a cluster, but then just stops. If I click Full Update again, I get a "Websocket is already in CLOSING or CLOSED state" in a crhome console

You are just a hero, I'm doing exactly the changes you did as you can see on my last commits. I promise to solve it until tomorrow and then I think it should work.

@emersonfelipesp
Copy link
Member

I created a fresh new install on my lab of both Proxmox 8.3.0 and Netbox 4.1.7 and trying to get all things done with my own README.md instructions, as I make corrections to the code.

But for now, if you guys really want to use it, will be necessary to make all the HTTPS/WSS changes @ctothelew did or just run it totally insecure, with Django manage.py runserver --insecure, as the HTTP Client (any WebBrowser) won't allow disabling INSECURE connections via API.

In the future, I can guarantee that both ends (Netbox and Proxbox Backend serve) will need to run securely, so unfortunaly the installation process will get harder, but I also want to make as much as automations I can to minimize the effort.

For now, there's no way to make the plugin "plug and play", but it is my wish to make the installation easy and all done through GUI.

Finally, I would like to really thank you guys for collaborating with code and test.

@LilTrublMakr
Copy link

I have followed the updated instructions in the README and unfortunately, I am still in the same place. No errors but also no information. I also made a domain in NGINX Proxy Manager for proxbox.domain.tld using HTTPS protocol and port 8800. I ran the service and manual server with the same result. When using Netbox, I am getting no connection logs, but when manually going to proxbox.domain.tld in a browser, I am getting connection logs and the following:

{"message":"Proxbox Backend made in FastAPI framework","proxbox":{"github":"https://github.com/netdevopsbr/netbox-proxbox","docs":"https://docs.netbox.dev.br"},"fastapi":{"github":"https://github.com/tiangolo/fastapi","website":"https://fastapi.tiangolo.com/","reason":"FastAPI was chosen because of performance and reliabilty."}}

Config:

    "netbox_proxbox": {
        "proxmox": {
            "domain": "192.168.42.201",
            "http_port": "8006",
            "user": "proxbox@pam",
            "token": {
                "name": "proxbox",
                "value": "nope"
            },
            "ssl": false
        },
        "netbox": {
            "domain": "netbox.domain.tld",
            "http_port": 8001,
            "token": "nope",
            "ssl": false,
            "settings": {
                "virtualmachine_role_id": 0,
                "node_role_id": 0,
                "site_id": 0
            }
        },
        "fastapi": {
            "uvicorn_host": "proxbox.domain.tld",
            "uvicorn_port": 8800
        }
    },

@ctothelew
Copy link

ctothelew commented Nov 23, 2024 via email

@ctothelew
Copy link

I've had a little more time to play around with this. Full update stops at
"The Manufacturer found is from 'Proxbox' (because it has the tag). Returning it."

Looking at the logs during the import I see this (I've edited them for brevity)

 Nov 23 03:33:08 uvicorn[25307]: INFO:     ('0.0.0.0.52', 28248) - "WebSocket /ws" [accepted]
Nov 23 03:33:08 uvicorn[25307]: INFO:     connection open
Nov 23 03:33:08 uvicorn[25307]: Establish Netbox connection...
Nov 23 03:33:08 uvicorn[25307]: INPUT is Pydantic Model ProxmoxSessionSchema
Nov 23 03:33:08 uvicorn[25307]: Using token to authenticate with Proxmox
Nov 23 03:33:08 uvicorn[25307]: INPUT is Pydantic Model ProxmoxSessionSchema
Nov 23 03:33:08 uvicorn[25307]: Using token to authenticate with Proxmox
Nov 23 03:33:08 uvicorn[25307]: INFO:     0.0.0.0.52:28250 - "GET /docs HTTP/1.1" 200 OK
Nov 23 03:33:08 uvicorn[25307]: Establish Netbox connection...
Nov 23 03:33:08 uvicorn[25307]: INFO:     0.0.0.0.52:28249 - "GET /netbox/status HTTP/1.1" 200 OK
Nov 23 03:33:08 uvicorn[25307]: INPUT is Pydantic Model ProxmoxSessionSchema
Nov 23 03:33:08 uvicorn[25307]: Using token to authenticate with Proxmox
Nov 23 03:33:08 uvicorn[25307]: INFO:     0.0.0.0.52:28251 - "GET /proxmox/version?source=netbox&list_all=false&plugin_name=netbox_proxbox&domain=ptg-pm1-int HTTP/1.1" 200 OK
Nov 23 03:33:08 uvicorn[25307]: INPUT is Pydantic Model ProxmoxSessionSchema
Nov 23 03:33:08 uvicorn[25307]: Using token to authenticate with Proxmox
Nov 23 03:33:08 uvicorn[25307]: INFO:     0.0.0.0.52:28251 - "GET /proxmox/sessions?source=netbox&list_all=false&plugin_name=netbox_proxbox&domain=ptg-pm1-int HTTP/1.1" 200 OK
Nov 23 03:33:08 uvicorn[25307]: INPUT is Pydantic Model ProxmoxSessionSchema
Nov 23 03:33:08 uvicorn[25307]: Using token to authenticate with Proxmox
Nov 23 03:33:08 uvicorn[25307]: INFO:     0.0.0.0.52:28251 - "GET /proxmox/version?source=netbox&list_all=false&plugin_name=netbox_proxbox&domain=ptg-pm1-int HTTP/1.1" 200 OK
Nov 23 03:33:09 uvicorn[25307]: INPUT is Pydantic Model ProxmoxSessionSchema
Nov 23 03:33:09 uvicorn[25307]: Using token to authenticate with Proxmox
Nov 23 03:33:09 uvicorn[25307]: INFO:     0.0.0.0.52:28251 - "GET /proxmox/sessions?source=netbox&list_all=false&plugin_name=netbox_proxbox&domain=ptg-pm1-int HTTP/1.1" 200 OK
Nov 23 03:33:09 uvicorn[25307]: INPUT is Pydantic Model ProxmoxSessionSchema
Nov 23 03:33:09 uvicorn[25307]: Using token to authenticate with Proxmox
Nov 23 03:33:09 uvicorn[25307]: INFO:     0.0.0.0.52:28251 - "GET /proxmox/version?source=netbox&list_all=false&plugin_name=netbox_proxbox&domain=ptg-pm1-int HTTP/1.1" 200 OK
Nov 23 03:33:09 uvicorn[25307]: INPUT is Pydantic Model ProxmoxSessionSchema
Nov 23 03:33:09 uvicorn[25307]: Using token to authenticate with Proxmox
Nov 23 03:33:09 uvicorn[25307]: INFO:     0.0.0.0.52:28251 - "GET /proxmox/sessions?source=netbox&list_all=false&plugin_name=netbox_proxbox&domain=ptg-pm1-int HTTP/1.1" 200 OK
Nov 23 03:33:09 uvicorn[25307]: INPUT is Pydantic Model ProxmoxSessionSchema
Nov 23 03:33:09 uvicorn[25307]: Using token to authenticate with Proxmox
...
Nov 23 03:33:12 uvicorn[25307]: proxbox [2024-11-23 03:33:12,167] [INFO] logging: <span class='badge text-bg-blue' title='Get'><strong><i class='mdi mdi-download'></i></strong></span> Getting <strong>Cluster</strong> from Netbox.
Nov 23 03:33:12 uvicorn[25307]: proxbox [2024-11-23 03:33:12,167] [INFO] logging: <span class='badge text-bg-blue' title='Get'><strong><i class='mdi mdi-download'></i></strong></span> Searching <strong>Cluster</strong> by kwargs {'name': 'ptg-pm-int'}.
Nov 23 03:33:12 uvicorn[25307]: proxbox [2024-11-23 03:33:12,262] [INFO] logging: <span class='badge text-bg-yellow' title='Syncing'><strong><i class='mdi mdi-download'></i></strong></span> Creating Device <strong>ptg-pm1-d</strong> related with the Virtual Machine(s)
Nov 23 03:33:12 uvicorn[25307]: proxbox [2024-11-23 03:33:12,262] [ERROR] logging: <span class='text-red'><strong><i class='mdi mdi-error'></i></strong></span> Error trying to create Netbox Device object.
Nov 23 03:33:12 uvicorn[25307]: proxbox [2024-11-23 03:33:12,279] [ERROR] logging: <span class='text-red'><strong><i class='mdi mdi-error'></i></strong></span> Error trying to create Netbox interface.
Nov 23 03:33:12 uvicorn[25307]: proxbox [2024-11-23 03:33:12,279] [ERROR] logging: <span class='text-red'><strong><i class='mdi mdi-error'></i></strong></span> Error trying to search bridge child interface.
Nov 23 03:33:12 uvicorn[25307]: proxbox [2024-11-23 03:33:12,291] [INFO] logging: <span class='badge text-bg-yellow' title='Syncing'><strong><i class='mdi mdi-download'></i></strong></span> Creating child interface of a bridge. Bridge interface and child must belong to the same device.
Nov 23 03:33:12 uvicorn[25307]: proxbox [2024-11-23 03:33:12,291] [ERROR] logging: <span class='text-red'><strong><i class='mdi mdi-error'></i></strong></span> Error trying to create Netbox interface.
Nov 23 03:33:12 uvicorn[25307]: proxbox [2024-11-23 03:33:12,291] [ERROR] logging: <span class='text-red'><strong><i class='mdi mdi-error'></i></strong></span> Error trying to create Netbox interface.
Nov 23 03:33:12 uvicorn[25307]: proxbox [2024-11-23 03:33:12,291] [ERROR] logging: <span class='text-red'><strong><i class='mdi mdi-error'></i></strong></span> Error trying to create Netbox interface.
Nov 23 03:33:12 uvicorn[25307]: proxbox [2024-11-23 03:33:12,291] [ERROR] logging: <span class='text-red'><strong><i class='mdi mdi-error'></i></strong></span> Error trying to create Netbox interface.
Nov 23 03:33:12 uvicorn[25307]: proxbox [2024-11-23 03:33:12,291] [ERROR] logging: <span class='text-red'><strong><i class='mdi mdi-error'></i></strong></span> Error trying to create Netbox interface.
Nov 23 03:33:12 uvicorn[25307]: proxbox [2024-11-23 03:33:12,292] [ERROR] logging: <span class='text-red'><strong><i class='mdi mdi-error'></i></strong></span> Error trying to search bridge child interface.
Nov 23 03:33:12 uvicorn[25307]: proxbox [2024-11-23 03:33:12,298] [INFO] logging: <span class='badge text-bg-yellow' title='Syncing'><strong><i class='mdi mdi-download'></i></strong></span> Creating child interface of a bridge. Bridge interface and child must belong to the same device.
Nov 23 03:33:12 uvicorn[25307]: proxbox [2024-11-23 03:33:12,298] [ERROR] logging: <span class='text-red'><strong><i class='mdi mdi-error'></i></strong></span> Error trying to create Netbox interface.
Nov 23 03:33:12 uvicorn[25307]: proxbox [2024-11-23 03:33:12,299] [ERROR] logging: <span class='text-red'><strong><i class='mdi mdi-error'></i></strong></span> Error trying to create Netbox interface.
Nov 23 03:33:12 uvicorn[25307]: proxbox [2024-11-23 03:33:12,299] [ERROR] logging: <span class='text-red'><strong><i class='mdi mdi-error'></i></strong></span> Error trying to create Netbox interface.
Nov 23 03:33:12 uvicorn[25307]: proxbox [2024-11-23 03:33:12,299] [ERROR] logging: <span class='text-red'><strong><i class='mdi mdi-error'></i></strong></span> Error trying to create Netbox interface.
Nov 23 03:33:12 uvicorn[25307]: proxbox [2024-11-23 03:33:12,299] [INFO] logging: <span class='badge text-bg-yellow' title='Syncing'><strong><i class='mdi mdi-download'></i></strong></span> Creating Device <strong>ptg-pm1-c</strong> related with the Virtual Machine(s)
Nov 23 03:33:12 uvicorn[25307]: proxbox [2024-11-23 03:33:12,299] [ERROR] logging: <span class='text-red'><strong><i class='mdi mdi-error'></i></strong></span> Error trying to create Netbox Device object.
Nov 23 03:33:12 uvicorn[25307]: proxbox [2024-11-23 03:33:12,313] [ERROR] logging: <span class='text-red'><strong><i class='mdi mdi-error'></i></strong></span> Error trying to create Netbox interface.
Nov 23 03:33:12 uvicorn[25307]: {'name': 'ptg-pm-int'}
Nov 23 03:33:12 uvicorn[25307]: {'level': '', 'maxcpu': 64, 'maxmem': 201389449216, 'id': 'node/ptg-pm1-d', 'maxdisk': 72722055168, 'uptime': 16381475, 'type': 'node', 'cpu': 0.0410771844583115, 'status': 'online', 'ssl_fingerprint': '1', 'disk': 11327848448, 'mem': 84157583360, 'node': 'ptg-pm1-d'}
Nov 23 03:33:12 uvicorn[25307]: interface_type: bridge / <class 'str'>
Nov 23 03:33:12 uvicorn[25307]: [0] interface: {'bridge_stp': 'off', 'bridge_vlan_aware': 1, 'bridge_fd': '0', 'families': ['inet'], 'type': 'bridge', 'method': 'manual', 'method6': 'manual', 'iface': 'vmbr1', 'bridge_vids': '2-4094', 'comments': '40G Bridge\n', 'bridge_ports': 'bond1', 'active': 1, 'autostart': 1, 'priority': 11}
Nov 23 03:33:12 uvicorn[25307]: interface_type: bridge
Nov 23 03:33:12 uvicorn[25307]: interface value type: <class 'dict'>
Nov 23 03:33:12 uvicorn[25307]: cidr: None
Nov 23 03:33:12 uvicorn[25307]: bridge_ports: bond1
Nov 23 03:33:12 uvicorn[25307]: port: bond1
Nov 23 03:33:12 uvicorn[25307]: proxmox_port: {'comments': '40G Bond\n', 'bond-primary': 'ens1f0np0', 'active': 1, 'bond_mode': 'active-backup', 'type': 'bond', 'families': ['inet'], 'bond_miimon': '100', 'method6': 'manual', 'method': 'manual', 'priority': 8, 'autostart': 1, 'slaves': 'ens1f0np0 ens1f1np1'}
Nov 23 03:33:12 uvicorn[25307]: interface: {'bridge_stp': 'off', 'bridge_vlan_aware': 1, 'bridge_fd': '0', 'families': ['inet'], 'type': 'bridge', 'method': 'manual', 'method6': 'manual', 'iface': 'vmbr1', 'bridge_vids': '2-4094', 'comments': '40G Bridge\n', 'bridge_ports': 'bond1', 'active': 1, 'autostart': 1, 'priority': 11}
Nov 23 03:33:12 uvicorn[25307]: interface_type: 10gbase-t / <class 'str'>
Nov 23 03:33:12 uvicorn[25307]: [0] interface: {'iface': 'ens1f1np1', 'autostart': 1, 'priority': 6, 'method6': 'manual', 'method': 'manual', 'families': ['inet'], 'exists': 1, 'type': 'eth', 'active': 1}
Nov 23 03:33:12 uvicorn[25307]: interface_type: 10gbase-t
Nov 23 03:33:12 uvicorn[25307]: interface value type: <class 'dict'>
Nov 23 03:33:12 uvicorn[25307]: cidr: None
Nov 23 03:33:12 uvicorn[25307]: interface: {'iface': 'ens1f1np1', 'autostart': 1, 'priority': 6, 'method6': 'manual', 'method': 'manual', 'families': ['inet'], 'exists': 1, 'type': 'eth', 'active': 1}
Nov 23 03:33:12 uvicorn[25307]: interface_type: other / <class 'str'>
Nov 23 03:33:12 uvicorn[25307]: [0] interface: {'active': 1, 'type': 'vlan', 'families': ['inet'], 'method6': 'manual', 'method': 'static', 'iface': 'vmbr0.56', 'cidr': '0.0.0.204/24', 'address': '0.0.0.204', 'netmask': '24', 'vlan-raw-device': 'vmbr0', 'exists': None, 'gateway': '0.0.0.1', 'vlan-id': '56', 'priority': 10, 'autostart': 1}
Nov 23 03:33:12 uvicorn[25307]: interface_type: other
Nov 23 03:33:12 uvicorn[25307]: interface value type: <class 'dict'>
Nov 23 03:33:12 uvicorn[25307]: cidr: 0.0.0.204/24
Nov 23 03:33:12 uvicorn[25307]: interface: {'active': 1, 'type': 'vlan', 'families': ['inet'], 'method6': 'manual', 'method': 'static', 'iface': 'vmbr0.56', 'cidr': '0.0.0.204/24', 'address': '0.0.0.204', 'netmask': '24', 'vlan-raw-device': 'vmbr0', 'exists': None, 'gateway': '0.0.0.1', 'vlan-id': '56', 'priority': 10, 'autostart': 1}
Nov 23 03:33:12 uvicorn[25307]: interface_type: lag / <class 'str'>
Nov 23 03:33:12 uvicorn[25307]: [0] interface: {'bond-primary': 'ens6f0np0', 'autostart': 1, 'priority': 7, 'slaves': 'ens6f0np0 ens6f1np1', 'bond_miimon': '100', 'active': 1, 'comments': '10G Bond\n', 'method6': 'manual', 'method': 'manual', 'iface': 'bond0', 'bond_mode': 'active-backup', 'type': 'bond', 'families': ['inet']}
Nov 23 03:33:12 uvicorn[25307]: interface_type: lag
Nov 23 03:33:12 uvicorn[25307]: interface value type: <class 'dict'>
Nov 23 03:33:12 uvicorn[25307]: cidr: None
Nov 23 03:33:12 uvicorn[25307]: interface: {'bond-primary': 'ens6f0np0', 'autostart': 1, 'priority': 7, 'slaves': 'ens6f0np0 ens6f1np1', 'bond_miimon': '100', 'active': 1, 'comments': '10G Bond\n', 'method6': 'manual', 'method': 'manual', 'iface': 'bond0', 'bond_mode': 'active-backup', 'type': 'bond', 'families': ['inet']}
Nov 23 03:33:12 uvicorn[25307]: interface_type: 10gbase-t / <class 'str'>
Nov 23 03:33:12 uvicorn[25307]: [0] interface: {'active': 1, 'iface': 'ens6f0np0', 'autostart': 1, 'priority': 3, 'method': 'manual', 'method6': 'manual', 'families': ['inet'], 'exists': 1, 'type': 'eth'}
Nov 23 03:33:12 uvicorn[25307]: interface_type: 10gbase-t
Nov 23 03:33:12 uvicorn[25307]: interface value type: <class 'dict'>
Nov 23 03:33:12 uvicorn[25307]: cidr: None
Nov 23 03:33:12 uvicorn[25307]: interface: {'active': 1, 'iface': 'ens6f0np0', 'autostart': 1, 'priority': 3, 'method': 'manual', 'method6': 'manual', 'families': ['inet'], 'exists': 1, 'type': 'eth'}
Nov 23 03:33:12 uvicorn[25307]: interface_type: bridge / <class 'str'>
Nov 23 03:33:12 uvicorn[25307]: [0] interface: {'bridge_vids': '2-4094', 'iface': 'vmbr0', 'method6': 'manual', 'method': 'manual', 'type': 'bridge', 'families': ['inet'], 'bridge_fd': '0', 'bridge_vlan_aware': 1, 'bridge_stp': 'off', 'active': 1, 'bridge_ports': 'bond0', 'comments': '10G Bridge\n', 'autostart': 1, 'priority': 9}
Nov 23 03:33:12 uvicorn[25307]: interface_type: bridge
Nov 23 03:33:12 uvicorn[25307]: interface value type: <class 'dict'>
Nov 23 03:33:12 uvicorn[25307]: cidr: None
Nov 23 03:33:12 uvicorn[25307]: bridge_ports: bond0
Nov 23 03:33:12 uvicorn[25307]: port: bond0
Nov 23 03:33:12 uvicorn[25307]: proxmox_port: {'active': 1, 'comments': '10G Bond\n', 'bond-primary': 'ens6f0np0', 'priority': 7, 'autostart': 1, 'method': 'manual', 'method6': 'manual', 'slaves': 'ens6f0np0 ens6f1np1', 'bond_mode': 'active-backup', 'bond_miimon': '100', 'families': ['inet'], 'type': 'bond'}
Nov 23 03:33:12 uvicorn[25307]: interface: {'bridge_vids': '2-4094', 'iface': 'vmbr0', 'method6': 'manual', 'method': 'manual', 'type': 'bridge', 'families': ['inet'], 'bridge_fd': '0', 'bridge_vlan_aware': 1, 'bridge_stp': 'off', 'active': 1, 'bridge_ports': 'bond0', 'comments': '10G Bridge\n', 'autostart': 1, 'priority': 9}
Nov 23 03:33:12 uvicorn[25307]: interface_type: 10gbase-t / <class 'str'>
Nov 23 03:33:12 uvicorn[25307]: [0] interface: {'iface': 'ens1f0np0', 'autostart': 1, 'priority': 5, 'method6': 'manual', 'method': 'manual', 'exists': 1, 'type': 'eth', 'families': ['inet'], 'active': 1}
Nov 23 03:33:12 uvicorn[25307]: interface_type: 10gbase-t
Nov 23 03:33:12 uvicorn[25307]: interface value type: <class 'dict'>
Nov 23 03:33:12 uvicorn[25307]: cidr: None
Nov 23 03:33:12 uvicorn[25307]: interface: {'iface': 'ens1f0np0', 'autostart': 1, 'priority': 5, 'method6': 'manual', 'method': 'manual', 'exists': 1, 'type': 'eth', 'families': ['inet'], 'active': 1}
Nov 23 03:33:12 uvicorn[25307]: interface_type: 10gbase-t / <class 'str'>
Nov 23 03:33:12 uvicorn[25307]: [0] interface: {'families': ['inet'], 'type': 'eth', 'exists': 1, 'method6': 'manual', 'method': 'manual', 'autostart': 1, 'iface': 'ens6f1np1', 'priority': 4, 'active': 1}
Nov 23 03:33:12 uvicorn[25307]: interface_type: 10gbase-t
Nov 23 03:33:12 uvicorn[25307]: interface value type: <class 'dict'>
Nov 23 03:33:12 uvicorn[25307]: cidr: None
Nov 23 03:33:12 uvicorn[25307]: interface: {'families': ['inet'], 'type': 'eth', 'exists': 1, 'method6': 'manual', 'method': 'manual', 'autostart': 1, 'iface': 'ens6f1np1', 'priority': 4, 'active': 1}
Nov 23 03:33:12 uvicorn[25307]: interface_type: other / <class 'str'>
Nov 23 03:33:12 uvicorn[25307]: [0] interface: {'priority': 12, 'autostart': 1, 'vlan-id': '300', 'exists': None, 'netmask': '24', 'vlan-raw-device': 'vmbr1', 'address': '0.0.0.14', 'cidr': '0.0.0.14/24', 'iface': 'vmbr1.300', 'method': 'static', 'method6': 'manual', 'families': ['inet'], 'type': 'vlan', 'active': 1}
Nov 23 03:33:12 uvicorn[25307]: interface_type: other
Nov 23 03:33:12 uvicorn[25307]: interface value type: <class 'dict'>
Nov 23 03:33:12 uvicorn[25307]: cidr: 0.0.0.14/24
Nov 23 03:33:12 uvicorn[25307]: interface: {'priority': 12, 'autostart': 1, 'vlan-id': '300', 'exists': None, 'netmask': '24', 'vlan-raw-device': 'vmbr1', 'address': '0.0.0.14', 'cidr': '0.0.0.14/24', 'iface': 'vmbr1.300', 'method': 'static', 'method6': 'manual', 'families': ['inet'], 'type': 'vlan', 'active': 1}
Nov 23 03:33:12 uvicorn[25307]: interface_type: lag / <class 'str'>
Nov 23 03:33:12 uvicorn[25307]: [0] interface: {'active': 1, 'comments': '40G Bond\n', 'iface': 'bond1', 'method6': 'manual', 'method': 'manual', 'families': ['inet'], 'type': 'bond', 'bond_mode': 'active-backup', 'bond-primary': 'ens1f0np0', 'slaves': 'ens1f0np0 ens1f1np1', 'priority': 8, 'autostart': 1, 'bond_miimon': '100'}
Nov 23 03:33:12 uvicorn[25307]: interface_type: lag
Nov 23 03:33:12 uvicorn[25307]: interface value type: <class 'dict'>
Nov 23 03:33:12 uvicorn[25307]: cidr: None
Nov 23 03:33:12 uvicorn[25307]: interface: {'active': 1, 'comments': '40G Bond\n', 'iface': 'bond1', 'method6': 'manual', 'method': 'manual', 'families': ['inet'], 'type': 'bond', 'bond_mode': 'active-backup', 'bond-primary': 'ens1f0np0', 'slaves': 'ens1f0np0 ens1f1np1', 'priority': 8, 'autostart': 1, 'bond_miimon': '100'}
Nov 23 03:33:12 uvicorn[25307]: {'id': 'node/ptg-pm1-c', 'maxdisk': 72722055168, 'type': 'node', 'uptime': 16533648, 'cpu': 0.0140390192459794, 'status': 'online', 'level': '', 'maxcpu': 64, 'maxmem': 201389449216, 'mem': 64853925888, 'node': 'ptg-pm1-c', 'ssl_fingerprint': '1', 'disk': 11014283264}
Nov 23 03:33:12 uvicorn[25307]: interface_type: other / <class 'str'>
Nov 23 03:33:12 uvicorn[25307]: [0] interface: {'active': 1, 'autostart': 1, 'families': ['inet'], 'iface': 'vmbr0.56', 'type': 'vlan', 'method6': 'manual', 'address': '0.0.0.203', 'cidr': '0.0.0.203/24', 'gateway': '0.0.0.1', 'vlan-raw-device': 'vmbr0', 'vlan-id': '56', 'netmask': '24', 'exists': None, 'method': 'static', 'priority': 10}
Nov 23 03:33:12 uvicorn[25307]: interface_type: other
Nov 23 03:33:12 uvicorn[25307]: interface value type: <class 'dict'>
Nov 23 03:33:12 uvicorn[25307]: cidr: 0.0.0.203/24
Nov 23 03:33:12 uvicorn[25307]: proxbox [2024-11-23 03:33:12,313] [ERROR] logging: <span class='text-red'><strong><i class='mdi mdi-error'></i></strong></span> Error trying to create Netbox interface.
Nov 23 03:33:12 uvicorn[25307]: proxbox [2024-11-23 03:33:12,313] [ERROR] logging: <span class='text-red'><strong><i class='mdi mdi-error'></i></strong></span> Error trying to create Netbox interface.
Nov 23 03:33:12 uvicorn[25307]: proxbox [2024-11-23 03:33:12,314] [ERROR] logging: <span class='text-red'><strong><i class='mdi mdi-error'></i></strong></span> Error trying to create Netbox interface.
Nov 23 03:33:12 uvicorn[25307]: proxbox [2024-11-23 03:33:12,314] [ERROR] logging: <span class='text-red'><strong><i class='mdi mdi-error'></i></strong></span> Error trying to create Netbox interface.
Nov 23 03:33:12 uvicorn[25307]: proxbox [2024-11-23 03:33:12,314] [ERROR] logging: <span class='text-red'><strong><i class='mdi mdi-error'></i></strong></span> Error trying to search bridge child interface.
Nov 23 03:33:12 uvicorn[25307]: proxbox [2024-11-23 03:33:12,325] [INFO] logging: <span class='badge text-bg-yellow' title='Syncing'><strong><i class='mdi mdi-download'></i></strong></span> Creating child interface of a bridge. Bridge interface and child must belong to the same device.
Nov 23 03:33:12 uvicorn[25307]: proxbox [2024-11-23 03:33:12,326] [ERROR] logging: <span class='text-red'><strong><i class='mdi mdi-error'></i></strong></span> Error trying to create Netbox interface.
Nov 23 03:33:12 uvicorn[25307]: proxbox [2024-11-23 03:33:12,326] [ERROR] logging: <span class='text-red'><strong><i class='mdi mdi-error'></i></strong></span> Error trying to create Netbox interface.
Nov 23 03:33:12 uvicorn[25307]: proxbox [2024-11-23 03:33:12,326] [ERROR] logging: <span class='text-red'><strong><i class='mdi mdi-error'></i></strong></span> Error trying to create Netbox interface.
Nov 23 03:33:12 uvicorn[25307]: proxbox [2024-11-23 03:33:12,326] [ERROR] logging: <span class='text-red'><strong><i class='mdi mdi-error'></i></strong></span> Error trying to create Netbox interface.
Nov 23 03:33:12 uvicorn[25307]: proxbox [2024-11-23 03:33:12,327] [ERROR] logging: <span class='text-red'><strong><i class='mdi mdi-error'></i></strong></span> Error trying to search bridge child interface.
Nov 23 03:33:12 uvicorn[25307]: proxbox [2024-11-23 03:33:12,334] [INFO] logging: <span class='badge text-bg-yellow' title='Syncing'><strong><i class='mdi mdi-download'></i></strong></span> Creating child interface of a bridge. Bridge interface and child must belong to the same device.
Nov 23 03:33:12 uvicorn[25307]: proxbox [2024-11-23 03:33:12,334] [ERROR] logging: <span class='text-red'><strong><i class='mdi mdi-error'></i></strong></span> Error trying to create Netbox interface.
Nov 23 03:33:12 uvicorn[25307]: proxbox [2024-11-23 03:33:12,334] [INFO] logging: <span class='badge text-bg-yellow' title='Syncing'><strong><i class='mdi mdi-download'></i></strong></span> Creating Device <strong>ptg-pm1-b</strong> related with the Virtual Machine(s)
Nov 23 03:33:12 uvicorn[25307]: proxbox [2024-11-23 03:33:12,334] [ERROR] logging: <span class='text-red'><strong><i class='mdi mdi-error'></i></strong></span> Error trying to create Netbox Device object.
Nov 23 03:33:12 uvicorn[25307]: proxbox [2024-11-23 03:33:12,342] [ERROR] logging: <span class='text-red'><strong><i class='mdi mdi-error'></i></strong></span> Error trying to create Netbox interface.
Nov 23 03:33:12 uvicorn[25307]: proxbox [2024-11-23 03:33:12,343] [ERROR] logging: <span class='text-red'><strong><i class='mdi mdi-error'></i></strong></span> Error trying to create Netbox interface.
Nov 23 03:33:12 uvicorn[25307]: proxbox [2024-11-23 03:33:12,343] [ERROR] logging: <span class='text-red'><strong><i class='mdi mdi-error'></i></strong></span> Error trying to create Netbox interface.
...
Nov 23 03:33:12 uvicorn[25307]: ERROR:    Exception in ASGI application
Nov 23 03:33:12 uvicorn[25307]: Traceback (most recent call last):
Nov 23 03:33:12 uvicorn[25307]:   File "/opt/netbox-4.1.6/venv/lib/python3.10/site-packages/uvicorn-0.32.1-py3.10.egg/uvicorn/protocols/websockets/websockets_impl.py", line 242, in run_asgi
Nov 23 03:33:12 uvicorn[25307]:     result = await self.app(self.scope, self.asgi_receive, self.asgi_send)  # type: ignore[func-returns-value]
Nov 23 03:33:12 uvicorn[25307]:   File "/opt/netbox-4.1.6/venv/lib/python3.10/site-packages/uvicorn-0.32.1-py3.10.egg/uvicorn/middleware/proxy_headers.py", line 60, in __call__
Nov 23 03:33:12 uvicorn[25307]:     return await self.app(scope, receive, send)
Nov 23 03:33:12 uvicorn[25307]:   File "/opt/netbox-4.1.6/venv/lib/python3.10/site-packages/fastapi-0.115.5-py3.10.egg/fastapi/applications.py", line 1054, in __call__
Nov 23 03:33:12 uvicorn[25307]:     await super().__call__(scope, receive, send)
Nov 23 03:33:12 uvicorn[25307]:   File "/opt/netbox-4.1.6/venv/lib/python3.10/site-packages/starlette-0.41.3-py3.10.egg/starlette/applications.py", line 113, in __call__
Nov 23 03:33:12 uvicorn[25307]:     await self.middleware_stack(scope, receive, send)
Nov 23 03:33:12 uvicorn[25307]:   File "/opt/netbox-4.1.6/venv/lib/python3.10/site-packages/starlette-0.41.3-py3.10.egg/starlette/middleware/errors.py", line 152, in __call__
Nov 23 03:33:12 uvicorn[25307]:     await self.app(scope, receive, send)
Nov 23 03:33:12 uvicorn[25307]:   File "/opt/netbox-4.1.6/venv/lib/python3.10/site-packages/starlette-0.41.3-py3.10.egg/starlette/middleware/cors.py", line 77, in __call__
Nov 23 03:33:12 uvicorn[25307]:     await self.app(scope, receive, send)
Nov 23 03:33:12 uvicorn[25307]:   File "/opt/netbox-4.1.6/venv/lib/python3.10/site-packages/starlette-0.41.3-py3.10.egg/starlette/middleware/exceptions.py", line 62, in __call__
Nov 23 03:33:12 uvicorn[25307]:     await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
Nov 23 03:33:12 uvicorn[25307]:   File "/opt/netbox-4.1.6/venv/lib/python3.10/site-packages/starlette-0.41.3-py3.10.egg/starlette/_exception_handler.py", line 53, in wrapped_app
Nov 23 03:33:12 uvicorn[25307]:     raise exc
Nov 23 03:33:12 uvicorn[25307]:   File "/opt/netbox-4.1.6/venv/lib/python3.10/site-packages/starlette-0.41.3-py3.10.egg/starlette/_exception_handler.py", line 42, in wrapped_app
Nov 23 03:33:12 uvicorn[25307]:     await app(scope, receive, sender)
Nov 23 03:33:12 uvicorn[25307]:   File "/opt/netbox-4.1.6/venv/lib/python3.10/site-packages/starlette-0.41.3-py3.10.egg/starlette/routing.py", line 715, in __call__
Nov 23 03:33:12 uvicorn[25307]:     await self.middleware_stack(scope, receive, send)
Nov 23 03:33:12 uvicorn[25307]:   File "/opt/netbox-4.1.6/venv/lib/python3.10/site-packages/starlette-0.41.3-py3.10.egg/starlette/routing.py", line 735, in app
Nov 23 03:33:12 uvicorn[25307]:     await route.handle(scope, receive, send)
Nov 23 03:33:12 uvicorn[25307]:   File "/opt/netbox-4.1.6/venv/lib/python3.10/site-packages/starlette-0.41.3-py3.10.egg/starlette/routing.py", line 362, in handle
Nov 23 03:33:12 uvicorn[25307]:     await self.app(scope, receive, send)
Nov 23 03:33:12 uvicorn[25307]:   File "/opt/netbox-4.1.6/venv/lib/python3.10/site-packages/starlette-0.41.3-py3.10.egg/starlette/routing.py", line 95, in app
Nov 23 03:33:12 uvicorn[25307]:     await wrap_app_handling_exceptions(app, session)(scope, receive, send)
Nov 23 03:33:12 uvicorn[25307]:   File "/opt/netbox-4.1.6/venv/lib/python3.10/site-packages/starlette-0.41.3-py3.10.egg/starlette/_exception_handler.py", line 53, in wrapped_app
Nov 23 03:33:12 uvicorn[25307]:     raise exc
Nov 23 03:33:12 uvicorn[25307]:   File "/opt/netbox-4.1.6/venv/lib/python3.10/site-packages/starlette-0.41.3-py3.10.egg/starlette/_exception_handler.py", line 42, in wrapped_app
Nov 23 03:33:12 uvicorn[25307]:     await app(scope, receive, sender)
Nov 23 03:33:12 uvicorn[25307]:   File "/opt/netbox-4.1.6/venv/lib/python3.10/site-packages/starlette-0.41.3-py3.10.egg/starlette/routing.py", line 93, in app
Nov 23 03:33:12 uvicorn[25307]:     await func(session)
Nov 23 03:33:12 uvicorn[25307]:   File "/opt/netbox-4.1.6/venv/lib/python3.10/site-packages/fastapi-0.115.5-py3.10.egg/fastapi/routing.py", line 383, in app
Nov 23 03:33:12 uvicorn[25307]:     await dependant.call(**solved_result.values)
Nov 23 03:33:12 uvicorn[25307]:   File "/opt/netbox/netbox/netbox-proxbox/netbox_proxbox/main.py", line 172, in websocket_endpoint
Nov 23 03:33:12 uvicorn[25307]:     await get_virtual_machines(nb=nb, pxs=pxs, websocket=websocket)
Nov 23 03:33:12 uvicorn[25307]:   File "/opt/netbox-4.1.6/netbox/netbox-proxbox/netbox_proxbox/backend/routes/proxbox/clusters/__init__.py", line 520, in get_virtual_machines
Nov 23 03:33:12 uvicorn[25307]:     devices[vm_node] = await Device(nb = nb, websocket = websocket).get(name = vm.get("node"))
Nov 23 03:33:12 uvicorn[25307]:   File "/opt/netbox-4.1.6/netbox/netbox-proxbox/netbox_proxbox/backend/routes/netbox/generic.py", line 95, in get
Nov 23 03:33:12 uvicorn[25307]:     self.base_dict = await self.get_base_dict()
Nov 23 03:33:12 uvicorn[25307]:   File "/opt/netbox-4.1.6/netbox/netbox-proxbox/netbox_proxbox/backend/routes/netbox/dcim/devices.py", line 22, in get_base_dict
Nov 23 03:33:12 uvicorn[25307]:     device_type = await DeviceType(nb = self.nb, websocket = self.websocket).get()
Nov 23 03:33:12 uvicorn[25307]:   File "/opt/netbox-4.1.6/netbox/netbox-proxbox/netbox_proxbox/backend/routes/netbox/generic.py", line 95, in get
Nov 23 03:33:12 uvicorn[25307]:     self.base_dict = await self.get_base_dict()
Nov 23 03:33:12 uvicorn[25307]:   File "/opt/netbox-4.1.6/netbox/netbox-proxbox/netbox_proxbox/backend/routes/netbox/dcim/device_types.py", line 21, in get_base_dict
Nov 23 03:33:12 uvicorn[25307]:     "manufacturer": manufacturer.id,
Nov 23 03:33:12 uvicorn[25307]: AttributeError: 'NoneType' object has no attribute 'id'
Nov 23 03:33:12 uvicorn[25307]: INFO:     connection closed

@emersonfelipesp
Copy link
Member

Hi @ctothelew I was able to reuse Netbox certificates at Uvicorn and adjusting CORS, it worked fine. Now I'm looking at corner cases like yours

Nov 23 03:33:12 uvicorn[25307]:   File "/opt/netbox-4.1.6/netbox/netbox-proxbox/netbox_proxbox/backend/routes/netbox/dcim/devices.py", line 22, in get_base_dict
Nov 23 03:33:12 uvicorn[25307]:     device_type = await DeviceType(nb = self.nb, websocket = self.websocket).get()
Nov 23 03:33:12 uvicorn[25307]:   File "/opt/netbox-4.1.6/netbox/netbox-proxbox/netbox_proxbox/backend/routes/netbox/generic.py", line 95, in get
Nov 23 03:33:12 uvicorn[25307]:     self.base_dict = await self.get_base_dict()
Nov 23 03:33:12 uvicorn[25307]:   File "/opt/netbox-4.1.6/netbox/netbox-proxbox/netbox_proxbox/backend/routes/netbox/dcim/device_types.py", line 21, in get_base_dict
Nov 23 03:33:12 uvicorn[25307]:     "manufacturer": manufacturer.id,
Nov 23 03:33:12 uvicorn[25307]: AttributeError: 'NoneType' object has no attribute 'id'
Nov 23 03:33:12 uvicorn[25307]: INFO:     connection closed

Fresh new install with latest Proxmox and Netbox versions working with last develop commit using SSL (self-signed) by default:

image

@LilTrublMakr
Copy link

I don't know if this is related to the connection problems, but I am also getting a "Mixed Content" warning in the web console: Mixed Content: The page at '<URL>' was loaded over HTTPS, but requested an insecure resource '<URL>'. This request has been blocked; the content must be served over HTTPS.

@emersonfelipesp
Copy link
Member

emersonfelipesp commented Nov 25, 2024

@LilTrublMakr

I don't know if this is related to the connection problems, but I am also getting a "Mixed Content" warning in the web console: Mixed Content: The page at '<URL>' was loaded over HTTPS, but requested an insecure resource '<URL>'. This request has been blocked; the content must be served over HTTPS.

It should be solved at latest commits, this problem is because Netbox is acting as HTTPS Client and requesting to HTTP Server (FastAPI backend), then rejecting it because the server-side is insecure. But using the new /contrib/proxbox.service file which then re-uses self-signed Netbox certificates, this problem "should" be solved. The better option would be having valid certificates on both sides and NOT only self-signed ones, I will try to improve it to automatically solve the those corner-cases.

OBS: Don't forget to use systemctl daemon-reload when using the new proxbox.service file.

@ctothelew
Copy link

@emersonfelipesp I wouldn't be surprised if my issues were because of my netbox instance. It's a clone of our production instance that I wanted to upgrade to netbox 4, and attempt to get this plugin working on it, before attempting it in production. I haven't had time to mess around any further...so if you have any ideas for things to try, let me know. I'm game to try anything, since it's just a test at this point.

Thanks for your hard work and help!

@emersonfelipesp
Copy link
Member

@emersonfelipesp I wouldn't be surprised if my issues were because of my netbox instance. It's a clone of our production instance that I wanted to upgrade to netbox 4, and attempt to get this plugin working on it, before attempting it in production. I haven't had time to mess around any further...so if you have any ideas for things to try, let me know. I'm game to try anything, since it's just a test at this point.

Thanks for your hard work and help!

For now, if you undo the changes you did and follow the new README instructions on get the plugin working, it should work. But it will still probably stops at your manufacturer problem, but I'm also checking the reason why.

Thank you for your patience and willing to help!

@emersonfelipesp
Copy link
Member

In the future, I plan to make my own async "NETBOX DIODE" solution and improve a lot data-validation, so user can get a more detailed error.

@LilTrublMakr
Copy link

Idk. I am still having a hell of a time getting to where you guys are. I have even spun up a fresh instance of Netbox and fresh everything with following the README explicitly. When going to the page, I get CORS errors when using the IP address of the machine in the fastapi section of settings (even with CORS_ORIGIN_WHITELIST and CSRF_TRUSTED_ORIGINS set). If I try the domain, localhost, or 127.0.0.1, I get connection refused errors.

I may just need to tap out until V4 is officially supported...

@emersonfelipesp
Copy link
Member

Idk. I am still having a hell of a time getting to where you guys are. I have even spun up a fresh instance of Netbox and fresh everything with following the README explicitly. When going to the page, I get CORS errors when using the IP address of the machine in the fastapi section of settings (even with CORS_ORIGIN_WHITELIST and CSRF_TRUSTED_ORIGINS set). If I try the domain, localhost, or 127.0.0.1, I get connection refused errors.

I may just need to tap out until V4 is officially supported...

Hi @LilTrublMakr I will add a way to dinamically add Netbox possible origins dynamically based on configuration.py to fix this CORS issue. I suggest to wait until this feature is added, or even when v4 is fully supported. It is a lot of variables and different environments, it always works for me, but to handle all these corner cases is a pretty hard work. Although I'm sure with all this feedback I'm getting, Proxbox will soon have a stable release supporting both Netbox and Proxmox latest versions!

@troycarpenter
Copy link

troycarpenter commented Nov 26, 2024

I have some kind of regression. I did a git pull and recompiled / installed (and I think I changed everything for https including the proxbox.service file).

The last line of the error I'm getting is this:

Nov 26 01:52:15 netbox uvicorn[124873]:   File "/opt/netbox/netbox/netbox-proxbox/netbox_proxbox/backend/routes/netbox/generic.py", line 428
Nov 26 01:52:15 netbox uvicorn[124873]:     f"<span class='badge text-bg-red' title='Post'><strong><i class='mdi mdi-upload'></i></strong></span> <strong>{self.object_name}</strong> object created succ
essfully. {self.object_name} ID: {getattr(response, "id", "Not specified.")}"
Nov 26 01:52:15 netbox uvicorn[124873]:
                                                     ^^
Nov 26 01:52:15 netbox uvicorn[124873]: SyntaxError: f-string: unmatched '('

@emersonfelipesp
Copy link
Member

Hi @troycarpenter, thank your for your feedback. I'm still coding this part.
As soon as I get Proxbox working on v4, I will then work on robust CI/CD pipelines to avoid this.

@troycarpenter
Copy link

Thanks. The latest updates with git pull seems to have fixed the error. Now working to get all the processes talking again.

@troycarpenter
Copy link

troycarpenter commented Nov 26, 2024

Ok, got all the services showing up as "successful" in the Netbox GUI. I hit the Full Update button and got this in the log box:

Getting Cluster Type from Netbox.
 Cluster Type found on Netbox. Checking if it's 'Proxbox' one...
 The Cluster Type found is from 'Proxbox' (because it has the tag). Returning it.
Failed to fetch cluster type for cluster: Proxbox Basic Cluster. As it is a required field, the cluster will not be created.
 Getting Cluster from Netbox.
 Searching Cluster by kwargs {'name': 'pve'}.
 Creating Device pve related with the Virtual Machine(s)
 Getting Site from Netbox.
 Site found on Netbox. Checking if it's 'Proxbox' one...
 The Site found is from 'Proxbox' (because it has the tag). Returning it.
 Getting Device Types from Netbox.
 Device Types found on Netbox. Checking if it's 'Proxbox' one...
 The Device Types found is from 'Proxbox' (because it has the tag). Returning it.
 Getting Manufacturer from Netbox.
 Manufacturer found on Netbox. Checking if it's 'Proxbox' one...
 The Manufacturer found is from 'Proxbox' (because it has the tag). Returning it.
Failed to fetch manufacturer for device type: Proxbox Basic Device Type
 Getting Device Types from Netbox.
 Device Types found on Netbox. Checking if it's 'Proxbox' one...
 The Device Types found is from 'Proxbox' (because it has the tag). Returning it.
 Getting Cluster Type from Netbox.
 Cluster Type found on Netbox. Checking if it's 'Proxbox' one...
 The Cluster Type found is from 'Proxbox' (because it has the tag). Returning it.
Failed to fetch cluster type for cluster: Proxbox Basic Cluster. As it is a required field, the cluster will not be created.
 Getting Cluster from Netbox.
 Cluster found on Netbox. Checking if it's 'Proxbox' one...
 The Cluster found is from 'Proxbox' (because it has the tag). Returning it.
Error trying to create Netbox Device object.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to search bridge child interface.
 Creating child interface of a bridge. Bridge interface and child must belong to the same device.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to search bridge child interface.
 Creating child interface of a bridge. Bridge interface and child must belong to the same device.
Error trying to search bridge child interface.
 Creating child interface of a bridge. Bridge interface and child must belong to the same device.
Error trying to create Netbox interface.
Error trying to search bridge child interface.
 Creating child interface of a bridge. Bridge interface and child must belong to the same device.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to search bridge child interface.
 Creating child interface of a bridge. Bridge interface and child must belong to the same device.
Error trying to create Netbox interface.
 Nodes: []
 Getting Site from Netbox.
 Site found on Netbox. Checking if it's 'Proxbox' one...
 The Site found is from 'Proxbox' (because it has the tag). Returning it.
 Getting Device Types from Netbox.
 Device Types found on Netbox. Checking if it's 'Proxbox' one...
 The Device Types found is from 'Proxbox' (because it has the tag). Returning it.
 Getting Device Types from Netbox.
 Device Types found on Netbox. Checking if it's 'Proxbox' one...
 The Device Types found is from 'Proxbox' (because it has the tag). Returning it.
 Getting Cluster Type from Netbox.
 Cluster Type found on Netbox. Checking if it's 'Proxbox' one...
 The Cluster Type found is from 'Proxbox' (because it has the tag). Returning it.
Failed to fetch cluster type for cluster: Proxbox Basic Cluster. As it is a required field, the cluster will not be created.
 Getting Cluster from Netbox.
 Cluster found on Netbox. Checking if it's 'Proxbox' one...
 The Cluster found is from 'Proxbox' (because it has the tag). Returning it.

HOWEVER, I don't exactly know what happened. I don't see any new VMs created (that is, new ones in Proxmox but were not in Netbox). And I can't tell if existing entities were changed in Netbox to match Proxmox.

I do find this error in the log:

Nov 26 16:53:52 netbox uvicorn[136105]: ERROR:    Exception in ASGI application
Nov 26 16:53:52 netbox uvicorn[136105]: Traceback (most recent call last):
Nov 26 16:53:52 netbox uvicorn[136105]:   File "/opt/netbox/venv/lib/python3.10/site-packages/uvicorn/protocols/websockets/websockets_impl.py", line 242, in run_asgi
Nov 26 16:53:52 netbox uvicorn[136105]:     result = await self.app(self.scope, self.asgi_receive, self.asgi_send)  # type: ignore[func-returns-value]
Nov 26 16:53:52 netbox uvicorn[136105]:   File "/opt/netbox/venv/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
Nov 26 16:53:52 netbox uvicorn[136105]:     return await self.app(scope, receive, send)
Nov 26 16:53:52 netbox uvicorn[136105]:   File "/opt/netbox/venv/lib/python3.10/site-packages/fastapi/applications.py", line 1054, in __call__
Nov 26 16:53:52 netbox uvicorn[136105]:     await super().__call__(scope, receive, send)
Nov 26 16:53:52 netbox uvicorn[136105]:   File "/opt/netbox/venv/lib/python3.10/site-packages/starlette/applications.py", line 113, in __call__
Nov 26 16:53:52 netbox uvicorn[136105]:     await self.middleware_stack(scope, receive, send)
Nov 26 16:53:52 netbox uvicorn[136105]:   File "/opt/netbox/venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 152, in __call__
Nov 26 16:53:52 netbox uvicorn[136105]:     await self.app(scope, receive, send)
Nov 26 16:53:52 netbox uvicorn[136105]:   File "/opt/netbox/venv/lib/python3.10/site-packages/starlette/middleware/cors.py", line 77, in __call__
Nov 26 16:53:52 netbox uvicorn[136105]:     await self.app(scope, receive, send)
Nov 26 16:53:52 netbox uvicorn[136105]:   File "/opt/netbox/venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
Nov 26 16:53:52 netbox uvicorn[136105]:     await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
Nov 26 16:53:52 netbox uvicorn[136105]:   File "/opt/netbox/venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 62, in wrapped_app
Nov 26 16:53:52 netbox uvicorn[136105]:     raise exc
Nov 26 16:53:52 netbox uvicorn[136105]:   File "/opt/netbox/venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 51, in wrapped_app
Nov 26 16:53:52 netbox uvicorn[136105]:     await app(scope, receive, sender)
Nov 26 16:53:52 netbox uvicorn[136105]:   File "/opt/netbox/venv/lib/python3.10/site-packages/starlette/routing.py", line 715, in __call__
Nov 26 16:53:52 netbox uvicorn[136105]:     await self.middleware_stack(scope, receive, send)
Nov 26 16:53:52 netbox uvicorn[136105]:   File "/opt/netbox/venv/lib/python3.10/site-packages/starlette/routing.py", line 735, in app
Nov 26 16:53:52 netbox uvicorn[136105]:     await route.handle(scope, receive, send)
Nov 26 16:53:52 netbox uvicorn[136105]:   File "/opt/netbox/venv/lib/python3.10/site-packages/starlette/routing.py", line 362, in handle
Nov 26 16:53:52 netbox uvicorn[136105]:     await self.app(scope, receive, send)
Nov 26 16:53:52 netbox uvicorn[136105]:   File "/opt/netbox/venv/lib/python3.10/site-packages/starlette/routing.py", line 95, in app
Nov 26 16:53:52 netbox uvicorn[136105]:     await wrap_app_handling_exceptions(app, session)(scope, receive, send)
Nov 26 16:53:52 netbox uvicorn[136105]:   File "/opt/netbox/venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 62, in wrapped_app
Nov 26 16:53:52 netbox uvicorn[136105]:     raise exc
Nov 26 16:53:52 netbox uvicorn[136105]:   File "/opt/netbox/venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 51, in wrapped_app
Nov 26 16:53:52 netbox uvicorn[136105]:     await app(scope, receive, sender)
Nov 26 16:53:52 netbox uvicorn[136105]:   File "/opt/netbox/venv/lib/python3.10/site-packages/starlette/routing.py", line 93, in app
Nov 26 16:53:52 netbox uvicorn[136105]:     await func(session)
Nov 26 16:53:52 netbox uvicorn[136105]:   File "/opt/netbox/venv/lib/python3.10/site-packages/fastapi/routing.py", line 383, in app
Nov 26 16:53:52 netbox uvicorn[136105]:     await dependant.call(**solved_result.values)
Nov 26 16:53:52 netbox uvicorn[136105]:   File "/opt/netbox/netbox/netbox-proxbox/netbox_proxbox/main.py", line 175, in websocket_endpoint
Nov 26 16:53:52 netbox uvicorn[136105]:     await get_virtual_machines(nb=nb, pxs=pxs, websocket=websocket)
Nov 26 16:53:52 netbox uvicorn[136105]:   File "/opt/netbox/netbox/netbox-proxbox/netbox_proxbox/backend/routes/proxbox/clusters/__init__.py", line 520, in get_virtual_machines
Nov 26 16:53:52 netbox uvicorn[136105]:     devices[vm_node] = await Device(nb = nb, websocket = websocket).get(name = vm.get("node"))
Nov 26 16:53:52 netbox uvicorn[136105]:   File "/opt/netbox/netbox/netbox-proxbox/netbox_proxbox/backend/routes/netbox/generic.py", line 95, in get
Nov 26 16:53:52 netbox uvicorn[136105]:     self.base_dict = await self.get_base_dict()
Nov 26 16:53:52 netbox uvicorn[136105]:   File "/opt/netbox/netbox/netbox-proxbox/netbox_proxbox/backend/routes/netbox/dcim/devices.py", line 29, in get_base_dict
Nov 26 16:53:52 netbox uvicorn[136105]:     "site": site.id,
Nov 26 16:53:52 netbox uvicorn[136105]: AttributeError: 'NoneType' object has no attribute 'id'
Nov 26 16:53:52 netbox uvicorn[136105]: INFO:     connection closed

@emersonfelipesp
Copy link
Member

Hi @troycarpenter I will review the logs you provided as soon as possible and I'll back with a solution. Thank you!

@emersonfelipesp
Copy link
Member

emersonfelipesp commented Nov 27, 2024

HOWEVER, I don't exactly know what happened. I don't see any new VMs created (that is, new ones in Proxmox but were not in > Netbox). And I can't tell if existing entities were changed in Netbox to match Proxmox.

@troycarpenter trying to solve it, I'm improving a bit the GUI to be more informative other than just logs.

When clicking to Sync Virtual Machines, a new table is created and populated as Proxbox updates Netbox. The image below is the first version, but I will add styling and links (like VM Name will link to the VM on Netbox directly)

image

@troycarpenter
Copy link

I tried the improve-gui branch, but the full update button now gives this error:

Dec  2 18:19:07 netbox uvicorn[166683]: ERROR:    Exception in ASGI application
Dec  2 18:19:07 netbox uvicorn[166683]: Traceback (most recent call last):
Dec  2 18:19:07 netbox uvicorn[166683]:   File "/opt/netbox/venv/lib/python3.10/site-packages/uvicorn/protocols/websockets/websockets_impl.py", line 242, in run_asgi
Dec  2 18:19:07 netbox uvicorn[166683]:     result = await self.app(self.scope, self.asgi_receive, self.asgi_send)  # type: ignore[func-returns-value]
Dec  2 18:19:07 netbox uvicorn[166683]:   File "/opt/netbox/venv/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
Dec  2 18:19:07 netbox uvicorn[166683]:     return await self.app(scope, receive, send)
Dec  2 18:19:07 netbox uvicorn[166683]:   File "/opt/netbox/venv/lib/python3.10/site-packages/fastapi/applications.py", line 1054, in __call__
Dec  2 18:19:07 netbox uvicorn[166683]:     await super().__call__(scope, receive, send)
Dec  2 18:19:07 netbox uvicorn[166683]:   File "/opt/netbox/venv/lib/python3.10/site-packages/starlette/applications.py", line 113, in __call__
Dec  2 18:19:07 netbox uvicorn[166683]:     await self.middleware_stack(scope, receive, send)
Dec  2 18:19:07 netbox uvicorn[166683]:   File "/opt/netbox/venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 152, in __call__
Dec  2 18:19:07 netbox uvicorn[166683]:     await self.app(scope, receive, send)
Dec  2 18:19:07 netbox uvicorn[166683]:   File "/opt/netbox/venv/lib/python3.10/site-packages/starlette/middleware/cors.py", line 77, in __call__
Dec  2 18:19:07 netbox uvicorn[166683]:     await self.app(scope, receive, send)
Dec  2 18:19:07 netbox uvicorn[166683]:   File "/opt/netbox/venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
Dec  2 18:19:07 netbox uvicorn[166683]:     await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
Dec  2 18:19:07 netbox uvicorn[166683]:   File "/opt/netbox/venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 62, in wrapped_app
Dec  2 18:19:07 netbox uvicorn[166683]:     raise exc
Dec  2 18:19:07 netbox uvicorn[166683]:   File "/opt/netbox/venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 51, in wrapped_app
Dec  2 18:19:07 netbox uvicorn[166683]:     await app(scope, receive, sender)
Dec  2 18:19:07 netbox uvicorn[166683]:   File "/opt/netbox/venv/lib/python3.10/site-packages/starlette/routing.py", line 715, in __call__
Dec  2 18:19:07 netbox uvicorn[166683]:     await self.middleware_stack(scope, receive, send)
Dec  2 18:19:07 netbox uvicorn[166683]:   File "/opt/netbox/venv/lib/python3.10/site-packages/starlette/routing.py", line 735, in app
Dec  2 18:19:07 netbox uvicorn[166683]:     await route.handle(scope, receive, send)
Dec  2 18:19:07 netbox uvicorn[166683]:   File "/opt/netbox/venv/lib/python3.10/site-packages/starlette/routing.py", line 362, in handle
Dec  2 18:19:07 netbox uvicorn[166683]:     await self.app(scope, receive, send)
Dec  2 18:19:07 netbox uvicorn[166683]:   File "/opt/netbox/venv/lib/python3.10/site-packages/starlette/routing.py", line 95, in app
Dec  2 18:19:07 netbox uvicorn[166683]:     await wrap_app_handling_exceptions(app, session)(scope, receive, send)
Dec  2 18:19:07 netbox uvicorn[166683]:   File "/opt/netbox/venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 62, in wrapped_app
Dec  2 18:19:07 netbox uvicorn[166683]:     raise exc
Dec  2 18:19:07 netbox uvicorn[166683]:   File "/opt/netbox/venv/lib/python3.10/site-packages/starlette/_exception_handler.py", line 51, in wrapped_app
Dec  2 18:19:07 netbox uvicorn[166683]:     await app(scope, receive, sender)
Dec  2 18:19:07 netbox uvicorn[166683]:   File "/opt/netbox/venv/lib/python3.10/site-packages/starlette/routing.py", line 93, in app
Dec  2 18:19:07 netbox uvicorn[166683]:     await func(session)
Dec  2 18:19:07 netbox uvicorn[166683]:   File "/opt/netbox/venv/lib/python3.10/site-packages/fastapi/routing.py", line 383, in app
Dec  2 18:19:07 netbox uvicorn[166683]:     await dependant.call(**solved_result.values)
Dec  2 18:19:07 netbox uvicorn[166683]:   File "/opt/netbox/netbox/netbox-proxbox/netbox_proxbox/main.py", line 184, in websocket_endpoint
Dec  2 18:19:07 netbox uvicorn[166683]:     await get_virtual_machines(nb=nb, pxs=pxs, websocket=websocket)
Dec  2 18:19:07 netbox uvicorn[166683]:   File "/opt/netbox/netbox/netbox-proxbox/netbox_proxbox/backend/routes/proxbox/clusters/__init__.py", line 554, in get_virtual_machines
Dec  2 18:19:07 netbox uvicorn[166683]:     await websocket.send_json({'object': 'cluster', 'type': 'update', 'data': cluster})
Dec  2 18:19:07 netbox uvicorn[166683]:   File "/opt/netbox/venv/lib/python3.10/site-packages/starlette/websockets.py", line 173, in send_json
Dec  2 18:19:07 netbox uvicorn[166683]:     text = json.dumps(data, separators=(",", ":"), ensure_ascii=False)
Dec  2 18:19:07 netbox uvicorn[166683]:   File "/usr/lib/python3.10/json/__init__.py", line 238, in dumps
Dec  2 18:19:07 netbox uvicorn[166683]:     **kw).encode(obj)
Dec  2 18:19:07 netbox uvicorn[166683]:   File "/usr/lib/python3.10/json/encoder.py", line 199, in encode
Dec  2 18:19:07 netbox uvicorn[166683]:     chunks = self.iterencode(o, _one_shot=True)
Dec  2 18:19:07 netbox uvicorn[166683]:   File "/usr/lib/python3.10/json/encoder.py", line 257, in iterencode
Dec  2 18:19:07 netbox uvicorn[166683]:     return _iterencode(o, 0)
Dec  2 18:19:07 netbox uvicorn[166683]:   File "/usr/lib/python3.10/json/encoder.py", line 179, in default
Dec  2 18:19:07 netbox uvicorn[166683]:     raise TypeError(f'Object of type {o.__class__.__name__} '
Dec  2 18:19:07 netbox uvicorn[166683]: TypeError: Object of type Record is not JSON serializable
Dec  2 18:19:07 netbox uvicorn[166683]: INFO:     connection closed

The screen shows the one VM where it crashed:
image
And in the log screen on the GUI:

 Searching Cluster by kwargs {'name': 'pve'}.
 Creating Device pve related with the Virtual Machine(s)
 Creating Device object on Netbox.
 Checking if Device exists on Netbox before creating it.
 (1) First attempt: Checking object making EXACT MATCH with the Payload provided...
 (1.5) Checking object using NAME and DEVICE provided by the Payload and also the PROXBOX TAG. If found, return it.
 (1.5.1) Checking duplicate using Device Object as parameter.
 (1.5.1.2) Device Object NOT found using Device ID as parameter. Trying to use Device NAME as parameter.
 Not abe to get Device Object using Device NAME neither Device ID as parameter.
 (2) Checking object using only NAME and SLUG provided by the Payload and also the PROXBOX TAG. If found, return it.
 (2.1) Searching object using GET method
 (3) Checking duplicate object using only NAME and SLUG
 Trying to create Device object on Netbox.
 Error trying to create Device object on Netbox. > The request failed with code 400 Bad Request: {'device_type': ['This field is required.'], 'role': ['This field is required.'], 'site': ['This field is required.']}
Error trying to create Netbox Device object.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to search bridge child interface.
 Creating child interface of a bridge. Bridge interface and child must belong to the same device.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to search bridge child interface.
 Creating child interface of a bridge. Bridge interface and child must belong to the same device.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to search bridge child interface.
 Creating child interface of a bridge. Bridge interface and child must belong to the same device.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
Error trying to search bridge child interface.
 Creating child interface of a bridge. Bridge interface and child must belong to the same device.
Error trying to search bridge child interface.
 Creating child interface of a bridge. Bridge interface and child must belong to the same device.
Error trying to create Netbox interface.
Error trying to create Netbox interface.
 Nodes: []
{"object":"virtual_machine","type":"create","data":{"disk":0,"diskread":142561602494,"template":0,"id":"qemu/101","cpu":0.0389353342545002,"netout":1871273994816,"maxcpu":8,"status":"running","maxdisk":322122547200,"mem":29327962112,"name":"flawless","diskwrite":2050943607808,"node":"pve","netin":2667201203987,"vmid":101,"maxmem":34359738368,"type":"qemu","uptime":7791013}}
{"object":"device","type":"create","data":{"name":"pve"}}
 Searching Device by kwargs {'name': 'pve'}.
{"object":"device","type":"update","data":null}
 Searching Cluster by kwargs {'name': 'pve'}.

@emersonfelipesp
Copy link
Member

@troycarpenter this branch isn't working yet, but I will fix it this weekend. I got no time this past week to work on the plugin, but I think next days will be better.

@quiknick
Copy link

quiknick commented Dec 21, 2024

No matter what I do I can't get past this error. tried v4.1.9 and v4.1.0

{
  "message": "Plugin configuration at PLUGINS_CONFIG (configuration.py) is probably incorrect.",
  "detail": "Could not feed 'PluginConfig' pydantic model with config provided from 'PLUGINS_CONFIG'.",
  "python_exception": "1 validation error for PluginConfig\nproxmox\n  Input should be a valid list [type=list_type, input_value={'domain': 'netbox.domain.n...'}, 'ssl': False}, input_type=dict]\n    For further information visit https://errors.pydantic.dev/2.10/v/list_type"
}
Netbox Proxbox configuration and Proxbox Default config found.
Netbox Proxbox configuration found.
INFO:     Started server process [2499657]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on https://0.0.0.0:8800 (Press CTRL+C to quit)
INFO:     x.x.x.x:35610 - "GET /docs HTTP/1.1" 200 OK
INFO:     x.x.x.x:35610 - "GET /openapi.json HTTP/1.1" 200 OK
INFO:     x.x.x.x:21596 - "GET /netbox/status?list_all=false&plugin_name=netbox_proxbox HTTP/1.1" 400 Bad Request

This could be related to this unresolved pull request fastapi pull request 9928

I also saw this in pydantic Issue 7669

The reason why it doesn't work like it did in V1 is that model validation is now done with the pydantic-core rust package. So instead of calling each submodel's model_validate (or from_orm) recursively in python, only the outermost model's method is called. The control flow then is passed to rust code, which performs validation purely based on the pydantic-core schema of this outermost model. If you want to have hooks back into python code you need to explicitly include them in the pydantic-core schema, either via the get_pydantic_core_schema method, model/field validators, Annotated metadata, or similar pydantic mechanisms. You cannot rely on the python method name resolution to find your custom method since these lookups are never attempted.

Note that this is the intended behaviour and cannot be "fixed", the whole reason why V2 is so much faster and offers other great benefits is that validation logic is performed in rust based on the core schema.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted This issue has been accepted for implementation
Projects
None yet
Development

No branches or pull requests