mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-16 12:12:53 -06:00
Show connected circuit termination on interface view
This commit is contained in:
parent
16d8308fa8
commit
cefec1be60
@ -1286,8 +1286,8 @@ class InterfaceView(View):
|
|||||||
|
|
||||||
return render(request, 'dcim/interface.html', {
|
return render(request, 'dcim/interface.html', {
|
||||||
'interface': interface,
|
'interface': interface,
|
||||||
# TODO: Also handle connected CircuitTerminations
|
|
||||||
'connected_interface': interface._connected_interface,
|
'connected_interface': interface._connected_interface,
|
||||||
|
'connected_circuittermination': interface._connected_circuittermination,
|
||||||
'ipaddress_table': ipaddress_table,
|
'ipaddress_table': ipaddress_table,
|
||||||
'vlan_table': vlan_table,
|
'vlan_table': vlan_table,
|
||||||
})
|
})
|
||||||
|
@ -122,80 +122,102 @@
|
|||||||
{% if interface.is_connectable %}
|
{% if interface.is_connectable %}
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<strong>Connected Interface</strong>
|
<strong>Connection</strong>
|
||||||
</div>
|
</div>
|
||||||
{% if connected_interface %}
|
{% if interface.cable %}
|
||||||
<table class="table table-hover panel-body attr-table">
|
<table class="table table-hover panel-body attr-table">
|
||||||
|
{% if connected_interface %}
|
||||||
|
<tr>
|
||||||
|
<td>Device</td>
|
||||||
|
<td>
|
||||||
|
<a href="{{ connected_interface.parent.get_absolute_url }}">{{ connected_interface.device }}</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Name</td>
|
||||||
|
<td>
|
||||||
|
<a href="{{ connected_interface.get_absolute_url }}">{{ connected_interface.name }}</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Type</td>
|
||||||
|
<td>{{ connected_interface.get_form_factor_display }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Enabled</td>
|
||||||
|
<td>
|
||||||
|
{% if connected_interface.enabled %}
|
||||||
|
<span class="text-success"><i class="fa fa-check"></i></span>
|
||||||
|
{% else %}
|
||||||
|
<span class="text-danger"><i class="fa fa-close"></i></span>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>LAG</td>
|
||||||
|
<td>
|
||||||
|
{% if connected_interface.lag%}
|
||||||
|
<a href="{{ connected_interface.lag.get_absolute_url }}">{{ connected_interface.lag }}</a>
|
||||||
|
{% else %}
|
||||||
|
<span class="text-muted">None</span>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Description</td>
|
||||||
|
<td>
|
||||||
|
{% if connected_interface.description %}
|
||||||
|
<span>{{ connected_interface.description }}</span>
|
||||||
|
{% else %}
|
||||||
|
<span class="text-muted">N/A</span>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>MTU</td>
|
||||||
|
<td>
|
||||||
|
{% if connected_interface.mtu %}
|
||||||
|
<span>{{ connected_interface.mtu }}</span>
|
||||||
|
{% else %}
|
||||||
|
<span class="text-muted">N/A</span>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>MAC Address</td>
|
||||||
|
<td>
|
||||||
|
{% if connected_interface.mac_address %}
|
||||||
|
<span>{{ connected_interface.mac_address }}</span>
|
||||||
|
{% else %}
|
||||||
|
<span class="text-muted">N/A</span>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>802.1Q Mode</td>
|
||||||
|
<td>{{ connected_interface.get_mode_display }}</td>
|
||||||
|
</tr>
|
||||||
|
{% elif connected_circuittermination %}
|
||||||
|
{% with ct=connected_circuittermination %}
|
||||||
|
<tr>
|
||||||
|
<td>Circuit</td>
|
||||||
|
<td><a href="{{ ct.circuit.get_absolute_url }}">{{ ct.circuit }}</a></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Side</td>
|
||||||
|
<td>{{ ct.term_side }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endwith %}
|
||||||
|
{% endif %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{% if connected_interface.device %}Device{% else %}Virtual Machine{% endif %}</td>
|
<td>Cable</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="{{ connected_interface.parent.get_absolute_url }}">{{ connected_interface.parent }}</a>
|
<a href="{{ interface.cable.get_absolute_url }}">{{ interface.cable }}</a>
|
||||||
|
<a href="{% url 'dcim:interface_trace' pk=interface.pk %}" class="btn btn-primary btn-xs" title="Trace">
|
||||||
|
<i class="fa fa-share-alt" aria-hidden="true"></i>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<td>Name</td>
|
|
||||||
<td>
|
|
||||||
<a href="{{ connected_interface.get_absolute_url }}">{{ connected_interface.name }}</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Type</td>
|
|
||||||
<td>{{ connected_interface.get_form_factor_display }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Enabled</td>
|
|
||||||
<td>
|
|
||||||
{% if connected_interface.enabled %}
|
|
||||||
<span class="text-success"><i class="fa fa-check"></i></span>
|
|
||||||
{% else %}
|
|
||||||
<span class="text-danger"><i class="fa fa-close"></i></span>
|
|
||||||
{% endif %}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>LAG</td>
|
|
||||||
<td>
|
|
||||||
{% if connected_interface.lag%}
|
|
||||||
<a href="{{ connected_interface.lag.get_absolute_url }}">{{ connected_interface.lag }}</a>
|
|
||||||
{% else %}
|
|
||||||
<span class="text-muted">None</span>
|
|
||||||
{% endif %}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Description</td>
|
|
||||||
<td>
|
|
||||||
{% if connected_interface.description %}
|
|
||||||
<span>{{ connected_interface.description }}</span>
|
|
||||||
{% else %}
|
|
||||||
<span class="text-muted">N/A</span>
|
|
||||||
{% endif %}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>MTU</td>
|
|
||||||
<td>
|
|
||||||
{% if connected_interface.mtu %}
|
|
||||||
<span>{{ connected_interface.mtu }}</span>
|
|
||||||
{% else %}
|
|
||||||
<span class="text-muted">N/A</span>
|
|
||||||
{% endif %}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>MAC Address</td>
|
|
||||||
<td>
|
|
||||||
{% if connected_interface.mac_address %}
|
|
||||||
<span>{{ connected_interface.mac_address }}</span>
|
|
||||||
{% else %}
|
|
||||||
<span class="text-muted">N/A</span>
|
|
||||||
{% endif %}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>802.1Q Mode</td>
|
|
||||||
<td>{{ connected_interface.get_mode_display }}</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Connection Status</td>
|
<td>Connection Status</td>
|
||||||
<td>
|
<td>
|
||||||
@ -209,31 +231,10 @@
|
|||||||
</table>
|
</table>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="panel-body text-muted">
|
<div class="panel-body text-muted">
|
||||||
No connected interface
|
Not connected
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="panel panel-default">
|
|
||||||
<div class="panel-heading">
|
|
||||||
<strong>Circuit Termination</strong>
|
|
||||||
</div>
|
|
||||||
<table class="table table-hover panel-body">
|
|
||||||
{% if interface.circuit_termination %}
|
|
||||||
<tr>
|
|
||||||
<td>Circuit</td>
|
|
||||||
<td><a href="{{ interface.circuit_termination.circuit.get_absolute_url }}">{{ interface.circuit_termination.circuit }}</a></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Side</td>
|
|
||||||
<td>{{ interface.circuit_termination.term_side }}</td>
|
|
||||||
</tr>
|
|
||||||
{% else %}
|
|
||||||
<tr>
|
|
||||||
<td colspan="2" class="text-muted">None</td>
|
|
||||||
</tr>
|
|
||||||
{% endif %}
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if interface.is_lag %}
|
{% if interface.is_lag %}
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
|
Loading…
Reference in New Issue
Block a user