{# Show only for non-VM contexts: true when no existing device (new import, not VM) OR when existing device is not a VM. #}
{% if not validation.existing_device and not validation.import_as_vm or validation.existing_device and existing_device_model_name != "virtualmachine" %}
Site
{% if validation.existing_device and validation.existing_device.site %}
{{ validation.existing_device.site }}
{% if validation.site.site and validation.existing_device.site.pk == validation.site.site.pk %}
{% endif %}
{% elif validation.site.site %}
{{ validation.site.site.name }}
{% else %}
No matching site
{% endif %}
{{ libre_device.location|default:"—" }}
{# Device Type row #}
Device Type
{% if validation.device_type_mismatch %}
{{ validation.existing_device.device_type }}
{% if libre_device.hardware and libre_device.hardware != "-" %}
{% include "netbox_librenms_plugin/htmx/_dt_mapping_form.html" with preselect_device_type=validation.existing_device.device_type submit_label="Map LibreNMS hardware to current type" %}
{% endif %}
{% elif validation.existing_device and validation.existing_device.device_type %}
{{ validation.existing_device.device_type }}
{% if sync_info and not sync_info.device_type_synced and sync_info.librenms_device_type %}
{% elif sync_info and not sync_info.device_type_synced and not sync_info.librenms_device_type and libre_device.hardware and libre_device.hardware != "-" %}
{# LibreNMS hardware has no NetBox mapping yet -- let the user create one, pre-selected to the existing device type so the common case is one click. #}
No mapping for LibreNMS hardware
{% include "netbox_librenms_plugin/htmx/_dt_mapping_form.html" with preselect_device_type=validation.existing_device.device_type submit_label="Map LibreNMS hardware to current type" %}
No matching type
{% include "netbox_librenms_plugin/htmx/_dt_mapping_form.html" %}
{% else %}
No matching type
{% endif %}
{% endif %}
{{ libre_device.hardware|default:"—" }}
{% endif %}
{# Serial row (only for devices) #}
{# Show only for non-VM contexts: true when no existing device (new import, not VM) OR when existing device is not a VM. #}
{% if not validation.existing_device and not validation.import_as_vm or validation.existing_device and existing_device_model_name != "virtualmachine" %}
Serial
{% if validation.existing_device %}
{% if validation.existing_device.serial %}
{{ validation.existing_device.serial }}
{% else %}
Not set
{% endif %}
{% if sync_info and not sync_info.serial_synced %}
{% if validation.serial_action == 'conflict' %}
{% else %}
{% endif %}
{% elif sync_info and sync_info.serial_synced and sync_info.librenms_serial != '-' %}
{% endif %}
{% else %}
—
{% endif %}
{% if validation.import_as_vm %}Role{% else %}Device Role{% endif %}
{% if validation.existing_device and validation.existing_device.role %}
{{ validation.existing_device.role }}
{% elif validation.device_role.role %}
{{ validation.device_role.role.name }}
{% else %}
No role assigned
{% endif %}
—
{# Platform row #}
Platform
{% if validation.existing_device and validation.existing_device.platform %}
{{ validation.existing_device.platform }}
{% if sync_info and not sync_info.platform_synced %}
{% if sync_info.platform_info.platform_exists %}
{% else %}
{% if libre_device.os and libre_device.os != "-" %}
{% endif %}
{% endif %}
{% elif sync_info and sync_info.platform_synced %}
{% endif %}
{% elif validation.existing_device %}
{# Existing device with no platform assigned — show Not set + sync button #}
Not set
{% if validation.platform.platform or sync_info and sync_info.platform_info.platform_exists %}
{% elif libre_device.os and libre_device.os != "-" %}
{% endif %}
{% elif validation.platform.platform %}
{# New import — platform will be assigned on import #}
{{ validation.platform.platform.name }}
{% else %}
{% if libre_device.os and libre_device.os != "-" %}
{% else %}
Optional
{% endif %}
{% endif %}
{% if libre_device.os and libre_device.os != "-" and sync_info and not sync_info.platform_info.platform_exists %}
{% include "netbox_librenms_plugin/htmx/_platform_mapping_form.html" with preselect_platform=validation.existing_device.platform %}
{% endif %}
{{ libre_device.os|default:"—" }}
{% if validation.import_as_vm and not validation.existing_device or validation.existing_device and existing_device_model_name == "virtualmachine" %}
{# Cluster row (VMs only) #}
Cluster
{% if validation.cluster.cluster %}
{{ validation.cluster.cluster.name }}
{% else %}
No cluster assigned
{% endif %}
{% if validation.existing_device and validation.existing_device.primary_ip %}
{{ validation.existing_device.primary_ip }}
{% elif libre_device.ip %}
{{ libre_device.ip }}
{% else %}
No primary IP
{% endif %}
{{ libre_device.ip|default:"—" }}
{# Status & Actions #}
{% if validation.existing_device %}
{% if validation.serial_action == 'merge_netbox_devices' %}
{# Stage 2: two NetBox devices appear to represent the same physical box. #}
Two NetBox devices
— A hostname match and a chassis-serial match resolved to two different NetBox
devices. Pick which one to keep; the other will be marked as merged.
Pick the device to keep (winner).
The other one becomes the donor and is absorbed.
Moved to winner: LibreNMS link (host id, OOB id, OOB type) and OOB IP (only if the winner has no OOB IP yet).
Stays on donor: interfaces, cables, primary IP. Re-home them later from the donor's "Migrated to ..." tab.
The donor device is not deleted. After you have re-homed its
child objects, you can delete it from NetBox manually if no longer needed.
Hostname match
{% if validation.serial_confirmed %}
Serial confirmed
{% elif validation.serial_action == 'conflict' %}
Serial conflict
{% elif validation.serial_action == 'update_serial' %}
Serial differs
{% endif %}
{% if validation.device_type_mismatch %}
Type mismatch
{% endif %}
— Exists as
{{ validation.existing_device.name }},
not linked to LibreNMS.
{% if validation.serial_action == 'conflict' %}
Import blocked: The incoming serial number is already assigned to another device in NetBox.
Resolve the duplicate serial before linking.
{% elif validation.import_as_vm or existing_device_model_name == "virtualmachine" %}
Hostname match found for a VM — use the import action to proceed.