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.
- circuits.Circuit
- circuits.Provider
- circuits.ProviderAccount
- circuits.ProviderNetwork
- core.DataSource
- dcim.Cable
- dcim.Device
- dcim.DeviceType
- dcim.Module
- dcim.ModuleType
- dcim.PowerFeed
- dcim.PowerPanel
- dcim.Rack
- dcim.RackReservation
- dcim.Site
- dcim.VirtualChassis
- dcim.VirtualDeviceContext
- ipam.Aggregate
- ipam.ASN
- ipam.FHRPGroup
- ipam.IPAddress
- ipam.IPRange
- ipam.Prefix
- ipam.RouteTarget
- ipam.Service
- ipam.ServiceTemplate
- ipam.VLAN
- ipam.VRF
- tenancy.Contact
- tenancy.Tenant
- virtualization.Cluster
- virtualization.VirtualMachine
- vpn.IKEPolicy
- vpn.IKEProposal
- vpn.IPSecPolicy
- vpn.IPSecProfile
- vpn.IPSecProposal
- vpn.L2VPN
- vpn.Tunnel
- wireless.WirelessLAN
- wireless.WirelessLink
Organizational Models
Organization models are used to organize and classify primary models.
- circuits.CircuitType
- dcim.DeviceRole
- dcim.Manufacturer
- dcim.Platform
- dcim.RackRole
- ipam.ASNRange
- ipam.RIR
- ipam.Role
- ipam.VLANGroup
- tenancy.ContactRole
- virtualization.ClusterGroup
- virtualization.ClusterType
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.
- dcim.Location (formerly RackGroup)
- dcim.Region
- dcim.SiteGroup
- tenancy.ContactGroup
- tenancy.TenantGroup
- wireless.WirelessLANGroup
Component Models
Component models represent individual physical or virtual components belonging to a device or virtual machine.
- dcim.ConsolePort
- dcim.ConsoleServerPort
- dcim.DeviceBay
- dcim.FrontPort
- dcim.Interface
- dcim.InventoryItem
- dcim.ModuleBay
- dcim.PowerOutlet
- dcim.PowerPort
- dcim.RearPort
- virtualization.VirtualDisk
- virtualization.VMInterface
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.