mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-22 20:12:00 -06:00
Closes #1202: Support overlapping assignment of NAT IP addresses
This commit is contained in:
parent
e2a02de6e9
commit
01d2ede097
@ -2,8 +2,13 @@
|
|||||||
|
|
||||||
## v3.3.0 (FUTURE)
|
## v3.3.0 (FUTURE)
|
||||||
|
|
||||||
|
### Breaking Changes
|
||||||
|
|
||||||
|
* The `nat_outside` relation on the IP address model now returns a list of zero or more related IP addresses, rather than a single instance (or None).
|
||||||
|
|
||||||
### Enhancements
|
### Enhancements
|
||||||
|
|
||||||
|
* [#1202](https://github.com/netbox-community/netbox/issues/1202) - Support overlapping assignment of NAT IP addresses
|
||||||
* [#8495](https://github.com/netbox-community/netbox/issues/8495) - Enable custom field grouping
|
* [#8495](https://github.com/netbox-community/netbox/issues/8495) - Enable custom field grouping
|
||||||
* [#8995](https://github.com/netbox-community/netbox/issues/8995) - Enable arbitrary ordering of REST API results
|
* [#8995](https://github.com/netbox-community/netbox/issues/8995) - Enable arbitrary ordering of REST API results
|
||||||
|
|
||||||
@ -15,3 +20,6 @@
|
|||||||
|
|
||||||
* extras.CustomField
|
* extras.CustomField
|
||||||
* Added `group_name` field
|
* Added `group_name` field
|
||||||
|
* ipam.IPAddress
|
||||||
|
* The `nat_inside` field no longer requires a unique value
|
||||||
|
* The `nat_outside` field has changed from a single IP address instance to a list of multiple IP addresses
|
||||||
|
@ -360,7 +360,7 @@ class IPAddressSerializer(NetBoxModelSerializer):
|
|||||||
)
|
)
|
||||||
assigned_object = serializers.SerializerMethodField(read_only=True)
|
assigned_object = serializers.SerializerMethodField(read_only=True)
|
||||||
nat_inside = NestedIPAddressSerializer(required=False, allow_null=True)
|
nat_inside = NestedIPAddressSerializer(required=False, allow_null=True)
|
||||||
nat_outside = NestedIPAddressSerializer(required=False, read_only=True)
|
nat_outside = NestedIPAddressSerializer(many=True, read_only=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = IPAddress
|
model = IPAddress
|
||||||
@ -369,7 +369,6 @@ class IPAddressSerializer(NetBoxModelSerializer):
|
|||||||
'assigned_object_id', 'assigned_object', 'nat_inside', 'nat_outside', 'dns_name', 'description', 'tags',
|
'assigned_object_id', 'assigned_object', 'nat_inside', 'nat_outside', 'dns_name', 'description', 'tags',
|
||||||
'custom_fields', 'created', 'last_updated',
|
'custom_fields', 'created', 'last_updated',
|
||||||
]
|
]
|
||||||
read_only_fields = ['family', 'nat_outside']
|
|
||||||
|
|
||||||
@swagger_serializer_method(serializer_or_field=serializers.DictField)
|
@swagger_serializer_method(serializer_or_field=serializers.DictField)
|
||||||
def get_assigned_object(self, obj):
|
def get_assigned_object(self, obj):
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('ipam', '0057_created_datetimefield'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='ipaddress',
|
||||||
|
name='nat_inside',
|
||||||
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='nat_outside', to='ipam.ipaddress'),
|
||||||
|
),
|
||||||
|
]
|
@ -813,7 +813,7 @@ class IPAddress(NetBoxModel):
|
|||||||
ct_field='assigned_object_type',
|
ct_field='assigned_object_type',
|
||||||
fk_field='assigned_object_id'
|
fk_field='assigned_object_id'
|
||||||
)
|
)
|
||||||
nat_inside = models.OneToOneField(
|
nat_inside = models.ForeignKey(
|
||||||
to='self',
|
to='self',
|
||||||
on_delete=models.SET_NULL,
|
on_delete=models.SET_NULL,
|
||||||
related_name='nat_outside',
|
related_name='nat_outside',
|
||||||
|
@ -91,8 +91,14 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">NAT (outside)</th>
|
<th scope="row">Outside NAT IPs</th>
|
||||||
<td>{{ object.nat_outside|linkify|placeholder }}</td>
|
<td>
|
||||||
|
{% for ip in object.nat_outside.all %}
|
||||||
|
{{ ip|linkify }}<br/>
|
||||||
|
{% empty %}
|
||||||
|
{{ ''|placeholder }}
|
||||||
|
{% endfor %}
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user