Skip to main content

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
Change loggingChangeLoggingMixin-Changes to these objects are automatically recorded in the change log
CloningCloningMixin-Provides the clone() method to prepare a copy
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
Export templatesExportTemplatesMixinexport_templatesUsers can create custom export templates for these models
Job resultsJobsMixinjobsBackground jobs can be scheduled for these models
JournalingJournalingMixinjournalingThese models support persistent historical commentary
Synchronized dataSyncedDataMixinsynced_dataCertain model data can be automatically synchronized from a remote data source
TaggingTagsMixintagsThe models can be tagged with user-defined tags
Event rulesEventRulesMixinevent_rulesEvent rules can send webhooks or run custom scripts automatically in response to events

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.