mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
137 lines
5.9 KiB
HTML
137 lines
5.9 KiB
HTML
{% load helpers %}
|
|
<tr class="interface{% if not iface.enabled %} danger{% endif %}" id="interface_{{ iface.name }}">
|
|
|
|
{# Checkbox #}
|
|
{% if perms.virtualization.change_vminterface or perms.virtualization.delete_vminterface %}
|
|
<td class="pk">
|
|
<input name="pk" type="checkbox" value="{{ iface.pk }}" />
|
|
</td>
|
|
{% endif %}
|
|
|
|
{# Name #}
|
|
<td>
|
|
<a href="{{ iface.get_absolute_url }}">{{ iface }}</a>
|
|
</td>
|
|
|
|
{# MAC address #}
|
|
<td class="text-monospace">
|
|
{{ iface.mac_address|default:"—" }}
|
|
</td>
|
|
|
|
{# MTU #}
|
|
<td>{{ iface.mtu|default:"—" }}</td>
|
|
|
|
{# 802.1Q mode #}
|
|
<td>{{ iface.get_mode_display|default:"—" }}</td>
|
|
|
|
{# Description/tags #}
|
|
<td>
|
|
{% if iface.description %}
|
|
{{ iface.description }}<br/>
|
|
{% endif %}
|
|
{% for tag in iface.tags.all %}
|
|
{% tag tag %}
|
|
{% empty %}
|
|
{% if not iface.description %}—{% endif %}
|
|
{% endfor %}
|
|
</td>
|
|
|
|
{# Buttons #}
|
|
<td class="text-right text-nowrap noprint">
|
|
{% if perms.ipam.add_ipaddress %}
|
|
<a href="{% url 'ipam:ipaddress_add' %}?vminterface={{ iface.pk }}&return_url={{ virtualmachine.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.virtualization.change_vminterface %}
|
|
<a href="{% url 'virtualization:vminterface_edit' pk=iface.pk %}?return_url={{ virtualmachine.get_absolute_url }}" class="btn btn-info btn-xs" title="Edit interface">
|
|
<i class="glyphicon glyphicon-pencil" aria-hidden="true"></i>
|
|
</a>
|
|
{% endif %}
|
|
{% if perms.virtualization.delete_vminterface %}
|
|
<a href="{% url 'virtualization:vminterface_delete' pk=iface.pk %}?return_url={{ virtualmachine.get_absolute_url }}" class="btn btn-danger btn-xs" title="Delete interface">
|
|
<i class="glyphicon glyphicon-trash" aria-hidden="true"></i>
|
|
</a>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
|
|
{% with ipaddresses=iface.ip_addresses.all %}
|
|
{% if ipaddresses %}
|
|
<tr class="ipaddresses">
|
|
{# Placeholder #}
|
|
{% if perms.virtualization.change_vminterface or perms.virtualization.delete_vminterface %}
|
|
<td></td>
|
|
{% endif %}
|
|
|
|
{# IP addresses table #}
|
|
<td colspan="9" 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>
|
|
|
|
{# IP address #}
|
|
<td>
|
|
<a href="{% url 'ipam:ipaddress' pk=ip.pk %}">{{ ip }}</a>
|
|
</td>
|
|
|
|
{# Primary/status/role #}
|
|
<td>
|
|
{% if virtualmachine.primary_ip4 == ip or virtualmachine.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>
|
|
{% 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>
|
|
{% if ip.description %}
|
|
{{ ip.description }}
|
|
{% else %}
|
|
<span class="text-muted">—</span>
|
|
{% endif %}
|
|
</td>
|
|
|
|
{# Buttons #}
|
|
<td class="text-right text-nowrap noprint">
|
|
{% if perms.ipam.change_ipaddress %}
|
|
<a href="{% url 'ipam:ipaddress_edit' pk=ip.pk %}?return_url={{ virtualmachine.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={{ virtualmachine.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 %}
|