Skip to content

Support the use of NetBox features by plugin models #8392

@jeremystretch

Description

@jeremystretch

NetBox version

v3.1.6

Feature type

New functionality

Proposed functionality

Officially support the use of various NetBox features by plugin models. These include:

  • Custom fields
  • Custom links
  • Custom validation
  • Export Templates
  • Journaling
  • Tags
  • Webhooks

For each feature above, we should introduce (or repurpose) a class which a model can inherit to enable the feature. For example, a TagsMixin class would enable the assignment of tags, and a CustomLinksMixin would enable custom links.

In the interest of cleanliness, we probably also want to introduce a base model class (e.g. BaseModel) that inherits all such feature mixins. A plugin model can then simply inherit from BaseModel to enable all features (while reserving the option to inherit only specific mixin classes if only a subset of features is desired).

I'd like to do away with the extras_features() decorator that's currently used to register features for specific models, as it's redundant for features which require additional fields or attributes on the model (see #8373). We may be able to leverage Django's class_prepared signal to automate this process.

Use case

This initiative will enable plugin authors to make use of many valuable features built into NetBox in a convenient and supported way.

Database changes

No response

External dependencies

No response

Metadata

Metadata

Assignees

Labels

status: acceptedThis issue has been accepted for implementationtopic: pluginsRelates to the plugins frameworktype: featureIntroduction of new functionality to the application

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions