{# SPDX-License-Identifier: Apache-2.0 #} {# Copyright (C) 2025 Marcin Zieba #} {# Lazy-loaded fragment: SNMP category (communities + v3 users + hosts + system info). #} {# Secret-safe: community strings and v3 passwords are never shown — only hashes/flags. #} {# Operators may Modify (edit) + Accept a row; the secret is supplied via the row's #} {# Vault ref and resolved at Apply time (the single device Apply pushes it). #} {% include "netbox_nso_plugin/categories/_adapter_error.html" %} {% url 'dcim:device_nso' pk=object.pk as return_url %} {% if snmp_data.communities or snmp_data.v3_users or snmp_data.hosts or snmp_data.system_info %}

Edit non-secret policy inline. Community strings and v3 passwords stay secret-safe and are managed through the Vault-aware edit actions; identity fields remain read-only here.

{% if snmp_data.system_info %} {% url 'plugins:netbox_nso_plugin:overlay_field_edit' key='snmp_system_info' pk=snmp_data.system_info.pk as sysinfo_edit_url %}
System Information
Location / ContactStatus / Synced
{{ snmp_data.system_info.location|default:"no location" }} · {{ snmp_data.system_info.contact|default:"no contact" }} {% include "netbox_nso_plugin/categories/_state_badge.html" with status=snmp_data.system_info.status %}
{% if snmp_data.system_info.last_sync_at %}{{ snmp_data.system_info.last_sync_at|date:"Y-m-d H:i" }}{% else %}not synced{% endif %}
{% url 'plugins:netbox_nso_plugin:snmp_accept_system_info' pk=snmp_data.system_info.pk as accept_url %}{% include "netbox_nso_plugin/categories/_accept_cell.html" with accept_url=accept_url status=snmp_data.system_info.status %}
{% endif %} {% if snmp_data.communities %}
Communities
{% include "netbox_nso_plugin/categories/_table_filter.html" with fid="flt-snmp-communities" placeholder="Filter by hash / access…" show_status=True %}
{% for c in snmp_data.communities %} {% url 'plugins:netbox_nso_plugin:overlay_field_edit' key='snmp_community' pk=c.pk as community_edit_url %} {% endfor %}
Community / PolicyVaultStatus / Synced
{{ c.community_hash }} {% if c.vault_ref %} {{ c.vault_ref|truncatechars:34 }} {% if c.vault_secret_hash %} {% if not snmp_data.snmp_value_compare %} Vault set — compare n/a {% elif c.vault_secret_hash == c.community_hash %} Vault ✓ matches device {% else %} Vault differs {% endif %} {% else %} unverified {% endif %} {% elif c.accepted_at %} no ref — not pushable {% else %} missing {% endif %} {% include "netbox_nso_plugin/categories/_state_badge.html" with status=c.status residue=c.residue_survivor residue_job=c.residue_job_id %}
{% if c.last_sync_at %}{{ c.last_sync_at|date:"Y-m-d H:i" }}{% else %}not synced{% endif %}
{% url 'plugins:netbox_nso_plugin:nsosnmpcommunitystate_edit' pk=c.pk as edit_url %}{% include "netbox_nso_plugin/categories/_edit_link.html" with edit_url=edit_url return_url=return_url %} {% url 'plugins:netbox_nso_plugin:snmp_accept_community' pk=c.pk as accept_url %}{% include "netbox_nso_plugin/categories/_accept_cell.html" with accept_url=accept_url status=c.status %} {% if c.vault_ref %}
{% csrf_token %}
{% endif %} {% if snmp_data.snmp_value_compare %}
{% csrf_token %}
{% endif %}
{% endif %} {% if snmp_data.v3_users %}
v3 Users
{% include "netbox_nso_plugin/categories/_table_filter.html" with fid="flt-snmp-v3" placeholder="Filter by username…" show_status=True %}
{% for u in snmp_data.v3_users %} {% endfor %}
User / SecurityVaultStatus / Synced
{{ u.username }}
{% if u.has_auth_secret %}auth{% else %}no auth{% endif %} {% if u.has_priv_secret %}priv{% else %}no priv{% endif %} {% if u.auth_protocol or u.priv_protocol %} · {{ u.auth_protocol|default:"no auth protocol" }}{% if u.priv_protocol %} / {{ u.priv_protocol }}{% endif %}{% endif %}
{% if u.vault_ref %} {{ u.vault_ref|truncatechars:30 }} {% if u.vault_has_auth %}auth{% endif %} {% if u.vault_has_priv %}priv{% endif %} {% if not u.vault_has_auth and not u.vault_has_priv %}unverified{% endif %} {% elif u.accepted_at %} no ref — not pushable {% else %} missing {% endif %} {% include "netbox_nso_plugin/categories/_state_badge.html" with status=u.status residue=u.residue_survivor residue_job=u.residue_job_id %}
{% if u.last_sync_at %}{{ u.last_sync_at|date:"Y-m-d H:i" }}{% else %}not synced{% endif %}
{% url 'plugins:netbox_nso_plugin:nsosnmpv3userstate_edit' pk=u.pk as edit_url %}{% include "netbox_nso_plugin/categories/_edit_link.html" with edit_url=edit_url return_url=return_url %} {% url 'plugins:netbox_nso_plugin:snmp_accept_v3_user' pk=u.pk as accept_url %}{% include "netbox_nso_plugin/categories/_accept_cell.html" with accept_url=accept_url status=u.status %} {% if u.vault_ref %}
{% csrf_token %}
{% endif %}
{% endif %} {% if snmp_data.hosts %}
Trap / Inform Hosts
{% include "netbox_nso_plugin/categories/_table_filter.html" with fid="flt-snmp-hosts" placeholder="Filter by address…" show_status=True %}
{% for h in snmp_data.hosts %} {% url 'plugins:netbox_nso_plugin:overlay_field_edit' key='snmp_host' pk=h.pk as host_edit_url %} {% endfor %}
DestinationNotificationStatus / Synced
{{ h.address }}
UDP {{ h.port|default:"162" }}
{% if h.notify_type == "inform" or h.notify_type == "informs" %}inform{% else %}trap{% endif %} · {% if h.version == "1" or h.version == "v1" %}v1{% elif h.version == "2" or h.version == "2c" or h.version == "v2c" %}v2c{% else %}v3{% endif %}{% if h.username %} · {{ h.username }}{% endif %} {% include "netbox_nso_plugin/categories/_state_badge.html" with status=h.status residue=h.residue_survivor residue_job=h.residue_job_id %}
{% if h.last_sync_at %}{{ h.last_sync_at|date:"Y-m-d H:i" }}{% else %}not synced{% endif %}
{% url 'plugins:netbox_nso_plugin:snmp_accept_host' pk=h.pk as accept_url %}{% include "netbox_nso_plugin/categories/_accept_cell.html" with accept_url=accept_url status=h.status %}
{% endif %} {% else %}

No SNMP configuration.

{% endif %}