{# SPDX-License-Identifier: Apache-2.0 #} {# Copyright (C) 2025 Marcin Zieba #} {% extends 'generic/object_list.html' %} {% block content %}
Interface Name Rules Reference

Define post-install interface rename rules for module types where NetBox's position-based naming can't produce the correct interface name.

Covers converter offset (e.g., CVR-X2-SFP + GLC-T), breakout transceivers (e.g., QSFP+ 4x10G with channel numbering), platform-specific naming (e.g., Juniper et-/xe-/ge- prefixes), and Virtual Chassis device port renaming (e.g., Gi0/1 → Gi2/1 on VC member 2).

Signal-driven: Rules run automatically via two Django signals:

  • post_save on Module — fires after a module is installed into a device bay (primary path for transceiver/linecard naming).
  • post_save on Device — fires after VC position changes (vc_position or virtual_chassis modified); triggers device-level interface renaming for VC members.

Both paths use on_commit deferred execution so that all interfaces are in the database before renaming begins.

Device interface rules (Applies to Device Interfaces checkbox) target native device-type interfaces (module=None) rather than module-installed interfaces. Use these to rename VC member ports when the device joins a stack or changes position. The Module Type Pattern field acts as an interface-name filter (regex) instead of a module type selector.

Supported Template Variables
VariableRule typeDescription
{slot}ModuleTop-level slot/module bay position (from grandparent or parent)
{bay_position}ModulePosition of the bay this module is installed into (raw, e.g., "swp1")
{bay_position_num}ModuleNumeric suffix of bay position (e.g., "swp1" → "1")
{parent_bay_position}ModulePosition of the parent module's bay
{sfp_slot}ModuleNumeric sub-bay index within the parent module
{base}BothOriginal interface name from the template (or current name for device-level rules)
{port}DeviceSegment after the last "/" in the current interface name (e.g., "Gi0/1" → "1"); full name if no "/"
{channel}ModuleBreakout channel number (iterated from Ch. Start to Ch. Start + Channels - 1)
{vc_position}BothVirtual Chassis member position (device.vc_position); requires device to be in a VC
Arithmetic Expressions

Arithmetic is supported inside braces: {8 + ({parent_bay_position} - 1) * 2 + {sfp_slot}}

Examples
  • Converter offset: GLC-T in CVR-X2-SFP → GigabitEthernet{slot}/{8 + ({parent_bay_position} - 1) * 2 + {sfp_slot}}
  • Breakout: QSFP-4X10G-LR → {base}:{channel} (Channels=4, Ch. Start=0)
  • Platform naming: QSFP-100G-LR4 on ACX7024 → et-0/0/{bay_position} (scoped via Parent Device Type)
  • UfiSpace breakout: QSFP-100G-LR4 on S9610-36D → swp{bay_position_num}s{channel} (Channels=2, Ch. Start=1)
  • Virtual Chassis linecard: VC-LINECARD on stack member → Gi{vc_position}/{bay_position_num} (requires device to be in a Virtual Chassis)
  • VC device ports (Cisco): GigabitEthernet1/0/3 on stack member 2 → GigabitEthernet{vc_position}/0/{port} → GigabitEthernet2/0/3 (device-level rule, pattern GigabitEthernet\d+/\d+/\d+)
  • VC device ports (Juniper): ge-0/0/2 on VC member 1 → ge-{vc_position}/0/{port} → ge-1/0/2 (device-level rule, pattern ge-\d+/\d+/\d+)
  • VC device ports (Arista): Ethernet1/3 on VC member 2 → Ethernet{vc_position}/{port} → Ethernet2/3 (device-level rule, pattern Ethernet\d+/\d+)
{{ block.super }} {% endblock %}