Assign IP Address to Interface from Interface List

This commit is contained in:
Stephen Maunder 2017-04-05 16:14:24 +01:00
parent 7766e1f684
commit cc99d47190
2 changed files with 26 additions and 3 deletions

View File

@ -1585,7 +1585,9 @@ def ipaddress_assign(request, pk):
return redirect('dcim:device', pk=device.pk)
else:
form = forms.IPAddressForm(device)
form = forms.IPAddressForm(device, initial={
'interface': request.GET.get('interface', None)
})
return render(request, 'dcim/ipaddress_assign.html', {
'device': device,

View File

@ -59,6 +59,11 @@
</button>
{% endif %}
{% endif %}
{% if perms.ipam.add_ipaddress %}
<a href="{% url 'dcim:ipaddress_assign' pk=device.pk %}?interface={{ iface.pk }}" class="btn btn-xs btn-primary">
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
</a>
{% endif %}
{% if perms.dcim.change_interface %}
{% if not iface.is_virtual %}
{% if iface.connection %}
@ -72,7 +77,7 @@
</a>
{% endif %}
<a href="{% url 'dcim:interfaceconnection_delete' pk=iface.connection.pk %}?device={{ device.pk }}" class="btn btn-danger btn-xs" title="Delete connection">
<i class="glyphicon glyphicon-remove" aria-hidden="true"></i>
<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">
@ -83,7 +88,7 @@
</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-plus" aria-hidden="true"></i>
<i class="glyphicon glyphicon-resize-small" aria-hidden="true"></i>
</a>
{% endif %}
{% endif %}
@ -104,3 +109,19 @@
{% endif %}
</td>
</tr>
{% if ip_addresses %}
{% for ip in ip_addresses %}
{% if ip.interface_id == iface.id %}
<tr style="background: #eff">
<td></td>
<td><a href="{% url 'ipam:ipaddress' pk=ip.pk %}">{{ ip }}</a></td>
<td>{{ ip.vrf|default:"Global" }}</td>
<td>{% if device.primary_ip4 == ip or device.primary_ip6 == ip %}
<span class="label label-success">Primary</span>
{% endif %}
</td>
<td colspan="2">{{ ip.description }}</td>
</tr>
{% endif %}
{% endfor %}
{% endif %}