Initial work on #93: Primary IPv4/IPv6 support

This commit is contained in:
Jeremy Stretch
2016-07-11 16:24:46 -04:00
parent f617828712
commit 4e4bb01a55
16 changed files with 203 additions and 45 deletions

View File

@@ -101,14 +101,29 @@
</td>
</tr>
<tr>
<td>Primary IP</td>
<td>Primary IPv4</td>
<td>
{% if device.primary_ip %}
<a href="{% url 'ipam:ipaddress' pk=device.primary_ip.pk %}">{{ device.primary_ip.address.ip }}</a>
{% if device.primary_ip.nat_inside %}
<span>(NAT for {{ device.primary_ip.nat_inside.address.ip }})</span>
{% elif device.primary_ip.nat_outside %}
<span>(NAT: {{ device.primary_ip.nat_outside.address.ip }})</span>
{% if device.primary_ip4 %}
<a href="{% url 'ipam:ipaddress' pk=device.primary_ip4.pk %}">{{ device.primary_ip4.address.ip }}</a>
{% if device.primary_ip4.nat_inside %}
<span>(NAT for {{ device.primary_ip4.nat_inside.address.ip }})</span>
{% elif device.primary_ip4.nat_outside %}
<span>(NAT: {{ device.primary_ip4.nat_outside.address.ip }})</span>
{% endif %}
{% else %}
<span class="text-muted">Not defined</span>
{% endif %}
</td>
</tr>
<tr>
<td>Primary IPv6</td>
<td>
{% if device.primary_ip6 %}
<a href="{% url 'ipam:ipaddress' pk=device.primary_ip6.pk %}">{{ device.primary_ip6.address.ip }}</a>
{% if device.primary_ip6.nat_inside %}
<span>(NAT for {{ device.primary_ip6.nat_inside.address.ip }})</span>
{% elif device.primary_ip6.nat_outside %}
<span>(NAT: {{ device.primary_ip6.nat_outside.address.ip }})</span>
{% endif %}
{% else %}
<span class="text-muted">Not defined</span>

View File

@@ -31,7 +31,10 @@
<div class="panel-body">
{% render_field form.platform %}
{% render_field form.status %}
{% if obj %}{% render_field form.primary_ip %}{% endif %}
{% if obj %}
{% render_field form.primary_ip4 %}
{% render_field form.primary_ip6 %}
{% endif %}
</div>
</div>
<div class="panel panel-default">

View File

@@ -4,7 +4,7 @@
</td>
<td>{{ ip.interface }}</td>
<td>
{% if device.primary_ip == ip %}
{% if device.primary_ip4 == ip or device.primary_ip6 == ip %}
<span class="label label-success">Primary</span>
{% endif %}
</td>