2017-11-03 16:58:56 -04:00
< tr class = "interface{% if not iface.enabled %} danger{% elif iface.connection and iface.connection.connection_status or iface.circuit_termination %} success{% elif iface.connection and not iface.connection.connection_status %} info{% elif iface.is_virtual %} warning{% endif %}" id = "iface_{{ iface.name }}" >
2018-01-30 16:34:42 -05:00
{# Checkbox #}
2017-11-03 16:58:56 -04:00
{% if perms.dcim.change_interface or perms.dcim.delete_interface %}
2016-07-26 10:14:51 -04:00
< td class = "pk" >
2018-01-30 16:34:42 -05:00
< input name = "pk" type = "checkbox" value = "{{ iface.pk }}" / >
2016-07-26 10:14:51 -04:00
< / td >
{% endif %}
2017-11-03 16:58:56 -04:00
{# Icon and name #}
< td >
< span title = "{{ iface.get_form_factor_display }}" >
< i class = "fa fa-fw fa-{% if iface.mgmt_only %}wrench{% elif iface.is_lag %}align-justify{% elif iface.is_virtual %}circle{% elif iface.is_wireless %}wifi{% else %}exchange{% endif %}" > < / i >
{{ iface }}
< / span >
< / td >
{# LAG #}
2016-03-01 11:23:03 -05:00
< td >
2017-02-27 16:52:13 -05:00
{% if iface.lag %}
2017-11-03 16:58:56 -04:00
< a href = "#iface_{{ iface.lag }}" class = "label label-default" > {{ iface.lag }}< / a >
2016-03-01 11:23:03 -05:00
{% endif %}
< / td >
2017-11-03 16:58:56 -04:00
{# Description #}
< td > {{ iface.description }}< / td >
{# MTU #}
2017-06-23 14:04:15 -04:00
< td > {{ iface.mtu|default:"" }}< / td >
2017-11-03 16:58:56 -04:00
{# MAC address #}
2017-05-02 15:01:27 -04:00
< td > {{ iface.mac_address|default:"" }}< / td >
2017-11-03 16:58:56 -04:00
{# Connection or type #}
2017-04-12 16:06:36 -04:00
{% if iface.is_lag %}
2017-05-05 15:37:42 -04:00
< td colspan = "2" class = "text-muted" >
LAG interface< br / >
< small class = "text-muted" > {{ iface.member_interfaces.all|join:", "|default:"No members" }}< / small >
< / td >
2017-04-12 16:06:36 -04:00
{% elif iface.is_virtual %}
2016-12-14 13:47:22 -05:00
< td colspan = "2" class = "text-muted" > Virtual interface< / td >
2017-06-16 17:52:09 -04:00
{% elif iface.is_wireless %}
< td colspan = "2" class = "text-muted" > Wireless interface< / td >
2016-03-01 11:23:03 -05:00
{% elif iface.connection %}
2016-12-27 13:21:19 -05:00
{% with iface.connected_interface as connected_iface %}
2016-03-01 11:23:03 -05:00
< td >
< a href = "{% url 'dcim:device' pk=connected_iface.device.pk %}" > {{ connected_iface.device }}< / a >
2016-07-06 14:40:40 -04:00
< / td >
< td >
2016-03-01 11:23:03 -05:00
< span title = "{{ connected_iface.get_form_factor_display }}" > {{ connected_iface }}< / span >
< / td >
{% endwith %}
2016-12-14 13:47:22 -05:00
{% elif iface.circuit_termination %}
{% with iface.circuit_termination.get_peer_termination as peer_termination %}
< td colspan = "2" >
2016-12-27 13:21:19 -05:00
< i class = "fa fa-fw fa-globe" title = "Circuit" > < / i >
2016-12-14 13:47:22 -05:00
{% if peer_termination %}
2017-03-22 16:58:56 -04:00
{% if peer_termination.interface %}
< a href = "{% url 'dcim:device' pk=peer_termination.interface.device.pk %}" > {{ peer_termination.interface.device }}< / a >
(< a href = "{% url 'dcim:site' slug=peer_termination.site.slug %}" > {{ peer_termination.site }}< / a > )
{% else %}
< a href = "{% url 'dcim:site' slug=peer_termination.site.slug %}" > {{ peer_termination.site }}< / a >
{% endif %}
via
2016-12-14 13:47:22 -05:00
{% endif %}
< a href = "{% url 'circuits:circuit' pk=iface.circuit_termination.circuit_id %}" > {{ iface.circuit_termination.circuit }}< / a >
< / td >
{% endwith %}
2016-03-01 11:23:03 -05:00
{% else %}
2016-07-06 14:40:40 -04:00
< td colspan = "2" >
< span class = "text-muted" > Not connected< / span >
< / td >
2016-03-01 11:23:03 -05:00
{% endif %}
2017-11-03 16:58:56 -04:00
{# Buttons #}
< td class = "text-right text-nowrap" >
2016-07-29 13:19:58 -04:00
{% if show_graphs %}
2016-12-14 13:47:22 -05:00
{% if iface.circuit_termination or iface.connection %}
2017-02-03 16:54:13 -05:00
< button type = "button" class = "btn btn-primary btn-xs" data-toggle = "modal" data-target = "#graphs_modal" data-obj = "{{ device.name }} - {{ iface.name }}" data-url = "{% url 'dcim-api:interface-graphs' pk=iface.pk %}" title = "Show graphs" >
2016-07-29 13:19:58 -04:00
< i class = "glyphicon glyphicon-signal" aria-hidden = "true" > < / i >
< / button >
{% endif %}
2016-03-01 11:23:03 -05:00
{% endif %}
2017-04-12 22:02:23 -04:00
{% if perms.ipam.add_ipaddress %}
2017-08-29 15:26:35 -04:00
< a href = "{% url 'ipam:ipaddress_add' %}?interface={{ iface.pk }}&return_url={{ device.get_absolute_url }}" class = "btn btn-xs btn-success" title = "Add IP address" >
2017-04-12 22:02:23 -04:00
< i class = "glyphicon glyphicon-plus" aria-hidden = "true" > < / i >
< / a >
{% endif %}
2016-03-01 11:23:03 -05:00
{% if perms.dcim.change_interface %}
2017-02-27 16:52:13 -05:00
{% if not iface.is_virtual %}
2016-03-01 11:23:03 -05:00
{% if iface.connection %}
{% if iface.connection.connection_status %}
< a href = "#" class = "btn btn-warning btn-xs interface-toggle connected" data = "{{ iface.connection.pk }}" title = "Mark planned" >
< i class = "glyphicon glyphicon-ban-circle" aria-hidden = "true" > < / i >
< / a >
{% else %}
2017-06-16 10:01:47 -04:00
< a href = "#" class = "btn btn-success btn-xs interface-toggle" data = "{{ iface.connection.pk }}" title = "Mark installed" >
2016-03-01 11:23:03 -05:00
< i class = "fa fa-plug" aria-hidden = "true" > < / i >
< / a >
{% endif %}
2017-12-21 15:08:05 -05:00
< a href = "{% url 'dcim:interfaceconnection_delete' pk=iface.connection.pk %}?return_url={{ device.get_absolute_url }}" class = "btn btn-danger btn-xs" title = "Disconnect" >
2017-04-12 22:02:23 -04:00
< i class = "glyphicon glyphicon-resize-full" aria-hidden = "true" > < / i >
2016-03-01 11:23:03 -05:00
< / a >
2016-12-14 13:47:22 -05:00
{% elif iface.circuit_termination and perms.circuits.change_circuittermination %}
< button class = "btn btn-warning btn-xs interface-toggle connected" disabled = "disabled" title = "Circuits cannot be marked as planned or connected" >
< i class = "glyphicon glyphicon-ban-circle" aria-hidden = "true" > < / i >
< / button >
2018-05-21 17:31:43 -04:00
< a href = "{% url 'circuits:circuittermination_edit' pk=iface.circuit_termination.pk %}?return_url={{ device.get_absolute_url }}" class = "btn btn-danger btn-xs" title = "Edit circuit termination" >
2017-04-12 22:02:23 -04:00
< i class = "glyphicon glyphicon-resize-full" aria-hidden = "true" > < / i >
2016-08-16 09:29:20 -04:00
< / a >
2016-03-01 11:23:03 -05:00
{% else %}
2017-12-15 15:57:49 -05:00
< a href = "{% url 'dcim:interfaceconnection_add' pk=device.pk %}?interface_a={{ iface.pk }}&return_url={{ device.get_absolute_url }}" class = "btn btn-success btn-xs" title = "Connect" >
2017-04-12 22:02:23 -04:00
< i class = "glyphicon glyphicon-resize-small" aria-hidden = "true" > < / i >
2016-03-01 11:23:03 -05:00
< / a >
{% endif %}
{% endif %}
2018-01-19 16:16:45 -05:00
< a href = "{% if iface.device_id %}{% url 'dcim:interface_edit' pk=iface.pk %}{% else %}{% url 'virtualization:interface_edit' pk=iface.pk %}{% endif %}" class = "btn btn-info btn-xs" title = "Edit interface" >
2016-03-01 11:23:03 -05:00
< i class = "glyphicon glyphicon-pencil" aria-hidden = "true" > < / i >
< / a >
{% endif %}
{% if perms.dcim.delete_interface %}
2016-12-14 13:47:22 -05:00
{% if iface.connection or iface.circuit_termination %}
2016-03-01 11:23:03 -05:00
< button class = "btn btn-danger btn-xs" disabled = "disabled" >
< i class = "glyphicon glyphicon-trash" aria-hidden = "true" > < / i >
< / button >
{% else %}
2018-02-27 14:59:45 -05:00
< a href = "{% if iface.device_id %}{% url 'dcim:interface_delete' pk=iface.pk %}{% else %}{% url 'virtualization:interface_delete' pk=iface.pk %}{% endif %}?return_url={{ device.get_absolute_url }}" class = "btn btn-danger btn-xs" title = "Delete interface" >
2016-03-01 11:23:03 -05:00
< i class = "glyphicon glyphicon-trash" aria-hidden = "true" > < / i >
< / a >
{% endif %}
{% endif %}
< / td >
< / tr >
2017-11-03 16:58:56 -04:00
2018-07-03 17:05:04 -04:00
{% with ipaddresses=iface.ip_addresses.all %}
{% if ipaddresses %}
< tr class = "ipaddresses" >
{# Placeholder #}
{% if perms.dcim.change_interface or perms.dcim.delete_interface %}
< td > < / td >
{% endif %}
2017-11-03 16:58:56 -04:00
2018-07-03 17:05:04 -04:00
{# IP addresses table #}
< td colspan = "8" style = "padding: 0" >
< table class = "table table-condensed interface-ips" >
< thead >
< tr class = "text-muted" >
< th class = "col-md-3" > IP Address< / th >
< th class = "col-md-2" > Status/Role< / th >
< th class = "col-md-3" > VRF< / th >
< th class = "col-md-3" > Description< / th >
< th class = "col-md-1" > < / th >
< / tr >
< / thead >
{% for ip in iface.ip_addresses.all %}
< tr >
2017-11-03 16:58:56 -04:00
2018-07-03 17:05:04 -04:00
{# IP address #}
< td >
< a href = "{% url 'ipam:ipaddress' pk=ip.pk %}" > {{ ip }}< / a >
< / td >
2017-11-03 16:58:56 -04:00
2018-07-03 17:05:04 -04:00
{# Primary/status/role #}
< td >
{% if device.primary_ip4 == ip or device.primary_ip6 == ip %}
< span class = "label label-success" > Primary< / span >
{% endif %}
< span class = "label label-{{ ip.get_status_class }}" > {{ ip.get_status_display }}< / span >
{% if ip.role %}
< span class = "label label-{{ ip.get_role_class }}" > {{ ip.get_role_display }}< / span >
{% endif %}
< / td >
2017-11-03 16:58:56 -04:00
2018-07-03 17:05:04 -04:00
{# VRF #}
< td >
{% if ip.vrf %}
< a href = "{% url 'ipam:vrf' pk=ip.vrf.pk %}" title = "{{ ip.vrf.rd }}" > {{ ip.vrf.name }}< / a >
{% else %}
< span class = "text-muted" > Global< / span >
{% endif %}
< / td >
2017-11-03 16:58:56 -04:00
2018-07-03 17:05:04 -04:00
{# Description #}
< td >
{% if ip.description %}
{{ ip.description }}
{% else %}
< span class = "text-muted" > — < / span >
{% endif %}
< / td >
{# Buttons #}
< td class = "text-right text-nowrap" >
{% if perms.ipam.change_ipaddress %}
< a href = "{% url 'ipam:ipaddress_edit' pk=ip.pk %}?return_url={{ device.get_absolute_url }}" class = "btn btn-info btn-xs" >
< i class = "glyphicon glyphicon-pencil" aria-hidden = "true" title = "Edit IP address" > < / i >
< / a >
{% endif %}
{% if perms.ipam.delete_ipaddress %}
< a href = "{% url 'ipam:ipaddress_delete' pk=ip.pk %}?return_url={{ device.get_absolute_url }}" class = "btn btn-danger btn-xs" >
< i class = "glyphicon glyphicon-trash" aria-hidden = "true" title = "Delete IP address" > < / i >
< / a >
{% endif %}
< / td >
< / tr >
{% endfor %}
< / table >
< / td >
< / tr >
{% endif %}
{% endwith %}