Skip to content

Data Backends

Data sources can be defined to reference data which exists on systems of record outside NetBox, such as a git repository or Amazon S3 bucket. Plugins can register their own backend classes to introduce support for additional resource types. This is done by subclassing NetBox's DataBackend class.

data_backends.py
from netbox.data_backends import DataBackend

class MyDataBackend(DataBackend):
    name = 'mybackend'
    label = 'My Backend'
    ...

To register one or more data backends with NetBox, define a list named backends at the end of this file:

data_backends.py
backends = [MyDataBackend]

Tip

The path to the list of search indexes can be modified by setting data_backends in the PluginConfig instance.

DataBackend

A data backend represents a specific system of record for data, such as a git repository or Amazon S3 bucket.

Attributes:

Name Type Description
name

The identifier under which this backend will be registered in NetBox

label

The human-friendly name for this backend

is_local

A boolean indicating whether this backend accesses local data

parameters

A dictionary mapping configuration form field names to their classes

sensitive_parameters

An iterable of field names for which the values should not be displayed to the user

init_config(self)

A hook to initialize the instance's configuration. The data returned by this method is assigned to the instance's config attribute upon initialization, which can be referenced by the fetch() method.

fetch(self)

A context manager which performs the following:

  1. Handles all setup and synchronization
  2. Yields the local path at which data has been replicated
  3. Performs any necessary cleanup