Skip to 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.

Feature Feature Mixin Registry Key Description
Change logging ChangeLoggingMixin - Changes to these objects are automatically recorded in the change log
Cloning CloningMixin - Provides the clone() method to prepare a copy
Custom fields CustomFieldsMixin custom_fields These models support the addition of user-defined fields
Custom links CustomLinksMixin custom_links These models support the assignment of custom links
Custom validation CustomValidationMixin - Supports the enforcement of custom validation rules
Export templates ExportTemplatesMixin export_templates Users can create custom export templates for these models
Job results JobsMixin jobs Users can create custom export templates for these models
Journaling JournalingMixin journaling These models support persistent historical commentary
Synchronized data SyncedDataMixin synced_data Certain model data can be automatically synchronized from a remote data source
Tagging TagsMixin tags The models can be tagged with user-defined tags
Event rules EventRulesMixin event_rules Event 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.