Replies: 2 comments
-
When writing a custom script, you're talking directly to the Django ORM. nbshell (the netbox shell) is the best way to explore this.
There are some sample scripts here, but otherwise it's up to you to learn how to use python and the Django ORM. If you've explicitly configured VLANs on each interface (e.g. set mode "access" or "tagged") then this information is available directly as properties on the interface in question. Example from nbshell:
If you haven't configured VLANs on each interface, then you'll need to enumerate all the IP addresses on the interface, find out which prefix each one belongs to, and see what VLAN each prefix belongs to. This is similar to discussion #10457, except that was using the REST API rather than the Django ORM. |
Beta Was this translation helpful? Give feedback.
-
Thank you Brian, that was the clue I was missing. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I would like to read out the VLAN ID of the interfaces for all devices (depending on the tag) through a custem script.
Unfortunately, I am not able to do this at the moment.
Can anyone give me a tip on how best to get the desired data?
Many thanks
Tobias
Beta Was this translation helpful? Give feedback.
All reactions