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') }}"| Parameter | Is |
|---|---|
| Device name | The device the port belongs to |
| Kind | The port's object type: Interface, ConsolePort, ConsoleServerPort, PowerPort, PowerOutlet, FrontPort or RearPort |
| Port name | The 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) }}'| Parameter | Is |
|---|---|
| Device name | The 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') }}"| Parameter | Is |
|---|---|
| Type | The object's type, as infra_type names it, such as Cable or Device |
field=value, repeated | The 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'| Parameter | Is |
|---|---|
| Device | The device, usually parent |
| Position | The 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.
| Parameter | Is |
|---|---|
| Path | The library path with its pin, such as dtl:device-types/Dell/PowerEdge-R640.yaml@fdf12828 |
| Device | Optional. 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.
| Parameter | Is |
|---|---|
| Path | The library path with its pin, such as dtl:module-types/Intel/X710-DA4.yaml@fdf12828 |
| Module position | Optional. Fills the {module} placeholder in the module's interface names |
| Device | Optional. 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.
| Parameter | Is |
|---|---|
| Reference | nbd: and the design's catalogue name |