Skip to content

New Custom Field Type for 'Generic' object relations. #4408

@tyler-8

Description

@tyler-8

Environment

  • Python version: v3.6.8
  • NetBox version: v2.6.12

Proposed Functionality

A new custom field type that introduces a generic way to link two objects together. When selecting the custom field type, there'd be a new selection called 'Object Relationship' and then a new dropdown where you'd have to select the object (circuit, site, IP address, etc) that you'd like the custom field value to point to.

Use Case

Overall this would allow users to create object relationships where they don't already exist in Netbox. In many cases, resorting to tags may not make sense as you'd end up with N-number of unique tags that only touch a couple objects - and even then don't show the direct relationship without some sort of external documentation.

One example: Link IP address and/or interface info with circuits where the L3 and L2 terminate at different points in the path; such as the physical termination being the switch, but the IP address and VLAN "terminate" on a router interface connected to the switch via a trunk.

There have been a number of FRs for VM-related features that just didn't make sense in the overall Netbox ecosystem, but I can see this helping to resolve a lot of 'missing links' for users that aren't cleanly helped by tags, but would be overkill to implement using the upcoming plugins functionality.

Process example:

  1. Create new custom field on circuits > circuit
  2. Type is 'Model relationship'
  3. Name is "Circuit IP"
  4. Select related object type ipam > ip address
  5. Click save
  6. Find target circuit and click edit
  7. Search for target IP in Select2 dropdown and click to select
  8. Save circuit
  9. IP now shows in Custom Fields section of Circuit Detail page

Database Changes

I think most (if not all) of the changes would be purely in the custom field space. Django does have the ability to do generic relationships and as Netbox is already utilizing the Content Types functionality, I suspect this should be doable without major surgery.

External Dependencies

N/A (unless there is a well-supported Django plugin that helps with this kind of thing)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions