Skip to content

Commit b7309d5

Browse files
committed
Closes #6054: Display NAPALM-enabled device tabs only when relevant
1 parent 6ec8ac7 commit b7309d5

File tree

4 files changed

+22
-25
lines changed

4 files changed

+22
-25
lines changed

docs/additional-features/napalm.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
NetBox supports integration with the [NAPALM automation](https://napalm-automation.net/) library. NAPALM allows NetBox to serve a proxy for operational data, fetching live data from network devices and returning it to a requester via its REST API. Note that NetBox does not store any NAPALM data locally.
44

5+
The NetBox UI will display tabs for status, LLDP neighbors, and configuration under the device view if the following conditions are met:
6+
7+
* Device status is "Active"
8+
* A primary IP has been assigned to the device
9+
* A platform with a NAPALM driver has been assigned
10+
* The authenticated user has the `dcim.napalm_read_device` permission
11+
512
!!! note
613
To enable this integration, the NAPALM library must be installed. See [installation steps](../../installation/3-netbox/#napalm) for more information.
714

docs/release-notes/version-2.10.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## v2.10.9 (FUTURE)
44

5+
### Enhancements
6+
7+
* [#6054](https://github.com/netbox-community/netbox/issues/6054) - Display NAPALM-enabled device tabs only when relevant
8+
59
### Bug Fixes
610

711
* [#6073](https://github.com/netbox-community/netbox/issues/6073) - Permit users to manage their own REST API tokens without needing explicit permission

netbox/templates/dcim/device/base.html

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -153,16 +153,17 @@ <h1>{{ object }}</h1>
153153
</li>
154154
{% endif %}
155155
{% endwith %}
156-
{% if perms.dcim.napalm_read_device %}
157-
{% if object.status != 'active' %}
158-
{% include 'dcim/inc/device_napalm_tabs.html' with disabled_message='Device must be in active status' %}
159-
{% elif not object.platform %}
160-
{% include 'dcim/inc/device_napalm_tabs.html' with disabled_message='No platform assigned to this device' %}
161-
{% elif not object.platform.napalm_driver %}
162-
{% include 'dcim/inc/device_napalm_tabs.html' with disabled_message='No NAPALM driver assigned for this platform' %}
163-
{% else %}
164-
{% include 'dcim/inc/device_napalm_tabs.html' %}
165-
{% endif %}
156+
{% if perms.dcim.napalm_read_device and object.status == 'active' and object.primary_ip and object.platform.napalm_driver %}
157+
{# NAPALM-enabled tabs #}
158+
<li role="presentation"{% if active_tab == 'status' %} class="active"{% endif %}>
159+
<a href="{% url 'dcim:device_status' pk=object.pk %}">Status</a>
160+
</li>
161+
<li role="presentation"{% if active_tab == 'lldp-neighbors' %} class="active"{% endif %}>
162+
<a href="{% url 'dcim:device_lldp_neighbors' pk=object.pk %}">LLDP Neighbors</a>
163+
</li>
164+
<li role="presentation"{% if active_tab == 'config' %} class="active"{% endif %}>
165+
<a href="{% url 'dcim:device_config' pk=object.pk %}">Configuration</a>
166+
</li>
166167
{% endif %}
167168
{% if perms.extras.view_configcontext %}
168169
<li role="presentation"{% if active_tab == 'config-context' %} class="active"{% endif %}>

netbox/templates/dcim/inc/device_napalm_tabs.html

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)