Docs
Reference

Functions

Every function a design can call, with its parameters and an example.

A function is called inside an expression while the design renders. It looks in the design's own objects first, then in what Designs read from the target NetBox. A function that finds nothing refuses the render, saying what it looked for. None of them allocate: a design states the names and addresses it wants.

nbd.lookup.endpoint

Finds a port on a device. Cables use it for their ends.

termination_a: "{{ nbd.lookup.endpoint('SW-01', 'Interface', 'GigabitEthernet1/0/1') }}"
ParameterIs
Device nameThe device the port belongs to
KindThe port's object type: Interface, ConsolePort, ConsoleServerPort, PowerPort, PowerOutlet, FrontPort or RearPort
Port nameThe port's name on that device

nbd.lookup.mgmt_interface

Finds a device's management interface: the interface marked management-only, preferring one whose name starts with mgmt or management when there are several. More than one candidate after that refuses the render.

assigned_object: '{{ nbd.lookup.mgmt_interface(variables.name) }}'
ParameterIs
Device nameThe device whose management interface to find

nbd.lookup.object

Finds any object by its type and the values of its fields.

cable: "{{ nbd.lookup.object('Cable', label='Router to Switch') }}"
ParameterIs
TypeThe object's type, as infra_type names it, such as Cable or Device
field=value, repeatedThe values the object must have

nbd.nbt.get_module_bay

Finds a device's module bay by its position. A device type from the Device Type Library creates its bays, and a module goes in one:

modules:
- infra_type: Module
  device: '{{ parent }}'
  module_bay: "{{ nbd.nbt.get_module_bay(parent, 'PCIE1') }}"
  module_type: 'dtl:module-types/Intel/X710-DA4.yaml@fdf12828'
ParameterIs
DeviceThe device, usually parent
PositionThe bay's position, such as 1 or PCIE1

nbd.dtl.device_type

Brings in a device type from the NetBox Device Type Library, with its manufacturer and the components it defines. A dtl: reference in a device_type field does the same, and is the usual way to write it. See Composition.

ParameterIs
PathThe library path with its pin, such as dtl:device-types/Dell/PowerEdge-R640.yaml@fdf12828
DeviceOptional. The device the components are for, usually parent

nbd.dtl.module_type

Brings in a module type from the Device Type Library, with its manufacturer and interfaces. A dtl: reference in a module_type field does the same.

ParameterIs
PathThe library path with its pin, such as dtl:module-types/Intel/X710-DA4.yaml@fdf12828
Module positionOptional. Fills the {module} placeholder in the module's interface names
DeviceOptional. The device the module's interfaces belong to

nbd.design.lookup

Loads a design from the catalogue by its nbd: reference. Including a design with design: nbd:<name> is the usual way to use one; see Composition.

ParameterIs
Referencenbd: and the design's catalogue name

On this page