Skip to content
Discussion options

You must be logged in to vote

Firstly, the selected device is supplied as "obj", not "device". see: https://netbox.readthedocs.io/en/stable/additional-features/custom-links/#context-data

For attributes of devices, you need to look at the models in the source code. For devices, the models are split over several files here. You can also explore the models interactively in the netbox shell.

Device does not have an attribute called "interface", but it does have one called "interfaces" - because a device can have more than one interface. Therefore you need to iterate over the interfaces to find the one that you want. The same applies for IP addresses on an interface - each interface can have multiple IP addresses.

Here is …

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@akanaykin
Comment options

@jeremystretch
Comment options

@akanaykin
Comment options

Answer selected by ryanmerolle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants