Skip to main content
Community
v4.4

NetBox Models

Model Types

A NetBox model represents a discrete object type such as a device or IP address. Per Django convention, each model is defined as a Python class and has its own table in the PostgreSQL database. All NetBox data models can be categorized by type.

The Django content types framework is used to map Django models to database tables. A ContentType instance references a model by its app_label and name: For example, the Site model within the DCIM app is referred to as dcim.site. The content type combined with an object's primary key form a globally unique identifier for the object (e.g. dcim.site:123).

Features Matrix

Depending on its classification, each NetBox model may support various features which enhance its operation. Each feature is enabled by inheriting from its designated mixin class, and some features also make use of the application registry.

FeatureFeature MixinRegistry KeyDescription
BookmarksBookmarksMixinbookmarksThese models can be bookmarked natively in the user interface
Change loggingChangeLoggingMixinchange_loggingChanges to these objects are automatically recorded in the change log
CloningCloningMixincloningProvides the clone() method to prepare a copy
ContactsContactsMixincontactsContacts can be associated with these models
Custom fieldsCustomFieldsMixincustom_fieldsThese models support the addition of user-defined fields
Custom linksCustomLinksMixincustom_linksThese models support the assignment of custom links
Custom validationCustomValidationMixin-Supports the enforcement of custom validation rules
Event rulesEventRulesMixinevent_rulesEvent rules can send webhooks or run custom scripts automatically in response to events
Export templatesExportTemplatesMixinexport_templatesUsers can create custom export templates for these models
Image attachmentsImageAttachmentsMixinimage_attachmentsImage uploads can be attached to these models
JobsJobsMixinjobsBackground jobs can be scheduled for these models
JournalingJournalingMixinjournalingThese models support persistent historical commentary
NotificationsNotificationsMixinnotificationsThese models support user notifications
Synchronized dataSyncedDataMixinsynced_dataCertain model data can be automatically synchronized from a remote data source
TaggingTagsMixintagsThe models can be tagged with user-defined tags
note

The above listed features are supported natively by NetBox. Beginning with NetBox v4.4.0, plugins can register their own model features as well.

Models Index

Primary Models

These are considered the "core" application models which are used to model network infrastructure.

Organizational Models

Organization models are used to organize and classify primary models.

Nested Group Models

Nested group models behave like organizational model, but self-nest within a recursive hierarchy. For example, the Region model can be used to represent a hierarchy of countries, states, and cities.

Component Models

Component models represent individual physical or virtual components belonging to a device or virtual machine.

Component Template Models

These function as templates to effect the replication of device and virtual machine components. Component template models support a limited feature set, including change logging, custom validation, and event rules.

Connection Models

Connection models are used to model the connections, or connection endpoints between models.

Related Topics