123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 |
- <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 }}">
- {# Checkbox #}
- {% if perms.dcim.change_interface or perms.dcim.delete_interface %}
- <td class="pk">
- <input name="pk" type="checkbox" value="{{ iface.pk }}" />
- </td>
- {% endif %}
- {# 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 #}
- <td>
- {% if iface.lag %}
- <a href="#iface_{{ iface.lag }}" class="label label-default">{{ iface.lag }}</a>
- {% endif %}
- </td>
- {# Description #}
- <td>{{ iface.description }}</td>
- {# MTU #}
- <td>{{ iface.mtu|default:"" }}</td>
- {# MAC address #}
- <td>{{ iface.mac_address|default:"" }}</td>
- {# Connection or type #}
- {% if iface.is_lag %}
- <td colspan="2" class="text-muted">
- LAG interface<br />
- <small class="text-muted">{{ iface.member_interfaces.all|join:", "|default:"No members" }}</small>
- </td>
- {% elif iface.is_virtual %}
- <td colspan="2" class="text-muted">Virtual interface</td>
- {% elif iface.is_wireless %}
- <td colspan="2" class="text-muted">Wireless interface</td>
- {% elif iface.connection %}
- {% with iface.connected_interface as connected_iface %}
- <td>
- <a href="{% url 'dcim:device' pk=connected_iface.device.pk %}">{{ connected_iface.device }}</a>
- </td>
- <td>
- <span title="{{ connected_iface.get_form_factor_display }}">{{ connected_iface }}</span>
- </td>
- {% endwith %}
- {% elif iface.circuit_termination %}
- {% with iface.circuit_termination.get_peer_termination as peer_termination %}
- <td colspan="2">
- <i class="fa fa-fw fa-globe" title="Circuit"></i>
- {% if peer_termination %}
- {% 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
- {% endif %}
- <a href="{% url 'circuits:circuit' pk=iface.circuit_termination.circuit_id %}">{{ iface.circuit_termination.circuit }}</a>
- </td>
- {% endwith %}
- {% else %}
- <td colspan="2">
- <span class="text-muted">Not connected</span>
- </td>
- {% endif %}
- {# Buttons #}
- <td class="text-right text-nowrap">
- {% if show_graphs %}
- {% if iface.circuit_termination or iface.connection %}
- <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">
- <i class="glyphicon glyphicon-signal" aria-hidden="true"></i>
- </button>
- {% endif %}
- {% endif %}
- {% if perms.ipam.add_ipaddress %}
- <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">
- <i class="glyphicon glyphicon-plus" aria-hidden="true"></i>
- </a>
- {% endif %}
- {% if perms.dcim.change_interface %}
- {% if not iface.is_virtual %}
- {% 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 %}
- <a href="#" class="btn btn-success btn-xs interface-toggle" data="{{ iface.connection.pk }}" title="Mark installed">
- <i class="fa fa-plug" aria-hidden="true"></i>
- </a>
- {% endif %}
- <a href="{% url 'dcim:interfaceconnection_delete' pk=iface.connection.pk %}?device={{ device.pk }}" class="btn btn-danger btn-xs" title="Disconnect">
- <i class="glyphicon glyphicon-resize-full" aria-hidden="true"></i>
- </a>
- {% 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>
- <a href="{% url 'circuits:circuittermination_edit' pk=iface.circuit_termination.pk %}" class="btn btn-danger btn-xs" title="Edit circuit termination">
- <i class="glyphicon glyphicon-resize-full" aria-hidden="true"></i>
- </a>
- {% else %}
- <a href="{% url 'dcim:interfaceconnection_add' pk=device.pk %}?interface_a={{ iface.pk }}" class="btn btn-success btn-xs" title="Connect">
- <i class="glyphicon glyphicon-resize-small" aria-hidden="true"></i>
- </a>
- {% endif %}
- {% endif %}
- <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">
- <i class="glyphicon glyphicon-pencil" aria-hidden="true"></i>
- </a>
- {% endif %}
- {% if perms.dcim.delete_interface %}
- {% if iface.connection or iface.circuit_termination %}
- <button class="btn btn-danger btn-xs" disabled="disabled">
- <i class="glyphicon glyphicon-trash" aria-hidden="true"></i>
- </button>
- {% else %}
- <a href="{% if iface.device_id %}{% url 'dcim:interface_delete' pk=iface.pk %}{% else %}{% url 'virtualization:interface_delete' pk=iface.pk %}{% endif %}" class="btn btn-danger btn-xs" title="Delete interface">
- <i class="glyphicon glyphicon-trash" aria-hidden="true"></i>
- </a>
- {% endif %}
- {% endif %}
- </td>
- </tr>
- {% for ip in iface.ip_addresses.all %}
- <tr class="ipaddress">
- {# Placeholder #}
- {% if perms.dcim.change_interface or perms.dcim.delete_interface %}
- <td></td>
- {% endif %}
- {# IP address #}
- <td colspan="2">
- <a href="{% url 'ipam:ipaddress' pk=ip.pk %}">{{ ip }}</a>
- </td>
- {# 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>
- {# VRF #}
- <td colspan="2">
- {% 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>
- {# Description #}
- <td colspan="2">
- {{ ip.description }}
- </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 %}
|