Netbox: Restore the "Parent" field in the IPAM view

Created on 27 Aug 2020  路  4Comments  路  Source: netbox-community/netbox

Environment

  • Python version: 3.7.9
  • NetBox version: 2.9.1

Proposed Functionality

It is not a new feature, I just want to get the parent field back in IPAM, it disappear with the 2.9.1 version
Here is a screenshot of 2.8.9 version of Netbox
image

There is no big changes, when I go to /api/ipam/ip-addresses/ with the 2.9.1, I got :

 "results": [
        {
            "id": 288,
            "url": "http://netbox/api/ipam/ip-addresses/288/",
            "family": {
                "value": 4,
                "label": "IPv4"
            },
            "address": "IP/32",
            "vrf": null,
            "tenant": null,
            "status": {
                "value": "active",
                "label": "Active"
            },
            "role": null,
            "assigned_object_type": "dcim.interface",
            "assigned_object_id": 288,
            "assigned_object": {
                "id": 288,
                "url": "http://netbox/api/dcim/interfaces/288/",
                "device": {
                    "id": 278,
                    "url": "http://netbox/api/dcim/devices/278/",
                    "name": "DEVICE NAME",
                    "display_name": "DISPLAY_NAME"
                },
                "name": "console",
                "cable": null,
                "connection_status": null
            },
            "nat_inside": null,
            "nat_outside": null,
            "dns_name": "DNS_NAME",
            "description": "",
            "tags": [],
            "custom_fields": {},
            "created": "2020-08-26",
            "last_updated": "2020-08-27T10:54:05.566978+02:00"
        },

The link is in ["assigned_object"]["device"]["url"], is it possible to add this to the view ?

Use Case

One less click to access the device and if we don't want to see the field we can hide him with "configure"
My team used to click on the "parent" field to go directly to the device.

Database Changes

No

External Dependencies

No

accepted feature

Most helpful comment

I've added "interface" and "parent" as non-default columns for the IP addresses table due to the performance penalty they introduce.

Interestingly, prefetching assigned_object for the API view _does_ yield a performance improvement, however the UI view seems to not take advantage of it, likely due to how django-tables2 is accessing record data. This probably warrants further investigation, but unfortunately I can't spend any more time on it at the moment.

All 4 comments

It was a really useful feature, so I definitely voting to return it back.

There is no big changes

If you'll refer to the v2.9 release notes, you'll see that the relationship between the IPAddress and Interface models has been completely replaced to accommodate the new VMInterface model, hence the change. The assignment of an IP address to an interface is now done using a GenericForeignKey. The REST API representation has likewise been modified to indicate a generic assigned_object as opposed to a device/interface as before.

I've added "interface" and "parent" as non-default columns for the IP addresses table due to the performance penalty they introduce.

Interestingly, prefetching assigned_object for the API view _does_ yield a performance improvement, however the UI view seems to not take advantage of it, likely due to how django-tables2 is accessing record data. This probably warrants further investigation, but unfortunately I can't spend any more time on it at the moment.

Wow, that was fast! Thanks Jeremy

Was this page helpful?
0 / 5 - 0 ratings