mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-27 02:48:38 -06:00
Rename mark_reserved to mark_populated
This commit is contained in:
parent
5f548725ee
commit
d82040bdc4
@ -147,7 +147,7 @@ class IPRangeSerializer(NetBoxModelSerializer):
|
|||||||
fields = [
|
fields = [
|
||||||
'id', 'url', 'display_url', 'display', 'family', 'start_address', 'end_address', 'size', 'vrf', 'tenant',
|
'id', 'url', 'display_url', 'display', 'family', 'start_address', 'end_address', 'size', 'vrf', 'tenant',
|
||||||
'status', 'role', 'description', 'comments', 'tags', 'custom_fields', 'created', 'last_updated',
|
'status', 'role', 'description', 'comments', 'tags', 'custom_fields', 'created', 'last_updated',
|
||||||
'mark_reserved', 'mark_utilized', 'description', 'comments', 'tags', 'custom_fields', 'created',
|
'mark_populated', 'mark_utilized', 'description', 'comments', 'tags', 'custom_fields', 'created',
|
||||||
'last_updated',
|
'last_updated',
|
||||||
]
|
]
|
||||||
brief_fields = ('id', 'url', 'display', 'family', 'start_address', 'end_address', 'description')
|
brief_fields = ('id', 'url', 'display', 'family', 'start_address', 'end_address', 'description')
|
||||||
|
@ -478,7 +478,7 @@ class IPRangeFilterSet(TenancyFilterSet, NetBoxModelFilterSet):
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = IPRange
|
model = IPRange
|
||||||
fields = ('id', 'mark_reserved', 'mark_utilized', 'size', 'description')
|
fields = ('id', 'mark_populated', 'mark_utilized', 'size', 'description')
|
||||||
|
|
||||||
def search(self, queryset, name, value):
|
def search(self, queryset, name, value):
|
||||||
if not value.strip():
|
if not value.strip():
|
||||||
|
@ -296,10 +296,10 @@ class IPRangeBulkEditForm(NetBoxModelBulkEditForm):
|
|||||||
queryset=Role.objects.all(),
|
queryset=Role.objects.all(),
|
||||||
required=False
|
required=False
|
||||||
)
|
)
|
||||||
mark_reserved = forms.NullBooleanField(
|
mark_populated = forms.NullBooleanField(
|
||||||
required=False,
|
required=False,
|
||||||
widget=BulkEditNullBooleanSelect(),
|
widget=BulkEditNullBooleanSelect(),
|
||||||
label=_('Treat as reserved')
|
label=_('Treat as populated')
|
||||||
)
|
)
|
||||||
mark_utilized = forms.NullBooleanField(
|
mark_utilized = forms.NullBooleanField(
|
||||||
required=False,
|
required=False,
|
||||||
|
@ -268,7 +268,7 @@ class IPRangeImportForm(NetBoxModelImportForm):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = IPRange
|
model = IPRange
|
||||||
fields = (
|
fields = (
|
||||||
'start_address', 'end_address', 'vrf', 'tenant', 'status', 'role', 'mark_reserved', 'mark_utilized',
|
'start_address', 'end_address', 'vrf', 'tenant', 'status', 'role', 'mark_populated', 'mark_utilized',
|
||||||
'description', 'comments', 'tags',
|
'description', 'comments', 'tags',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -266,7 +266,7 @@ class IPRangeFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
|||||||
model = IPRange
|
model = IPRange
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet('q', 'filter_id', 'tag'),
|
FieldSet('q', 'filter_id', 'tag'),
|
||||||
FieldSet('family', 'vrf_id', 'status', 'role_id', 'mark_reserved', 'mark_utilized', name=_('Attributes')),
|
FieldSet('family', 'vrf_id', 'status', 'role_id', 'mark_populated', 'mark_utilized', name=_('Attributes')),
|
||||||
FieldSet('tenant_group_id', 'tenant_id', name=_('Tenant')),
|
FieldSet('tenant_group_id', 'tenant_id', name=_('Tenant')),
|
||||||
)
|
)
|
||||||
family = forms.ChoiceField(
|
family = forms.ChoiceField(
|
||||||
@ -291,9 +291,9 @@ class IPRangeFilterForm(TenancyFilterForm, NetBoxModelFilterSetForm):
|
|||||||
null_option='None',
|
null_option='None',
|
||||||
label=_('Role')
|
label=_('Role')
|
||||||
)
|
)
|
||||||
mark_reserved = forms.NullBooleanField(
|
mark_populated = forms.NullBooleanField(
|
||||||
required=False,
|
required=False,
|
||||||
label=_('Treat as reserved'),
|
label=_('Treat as populated'),
|
||||||
widget=forms.Select(
|
widget=forms.Select(
|
||||||
choices=BOOLEAN_WITH_BLANK_CHOICES
|
choices=BOOLEAN_WITH_BLANK_CHOICES
|
||||||
)
|
)
|
||||||
|
@ -257,7 +257,7 @@ class IPRangeForm(TenancyForm, NetBoxModelForm):
|
|||||||
|
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
FieldSet(
|
FieldSet(
|
||||||
'vrf', 'start_address', 'end_address', 'role', 'status', 'mark_reserved', 'mark_utilized', 'description',
|
'vrf', 'start_address', 'end_address', 'role', 'status', 'mark_populated', 'mark_utilized', 'description',
|
||||||
'tags', name=_('IP Range')
|
'tags', name=_('IP Range')
|
||||||
),
|
),
|
||||||
FieldSet('tenant_group', 'tenant', name=_('Tenancy')),
|
FieldSet('tenant_group', 'tenant', name=_('Tenancy')),
|
||||||
@ -266,7 +266,7 @@ class IPRangeForm(TenancyForm, NetBoxModelForm):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = IPRange
|
model = IPRange
|
||||||
fields = [
|
fields = [
|
||||||
'vrf', 'start_address', 'end_address', 'status', 'role', 'tenant_group', 'tenant', 'mark_reserved',
|
'vrf', 'start_address', 'end_address', 'status', 'role', 'tenant_group', 'tenant', 'mark_populated',
|
||||||
'mark_utilized', 'description', 'comments', 'tags',
|
'mark_utilized', 'description', 'comments', 'tags',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ class Migration(migrations.Migration):
|
|||||||
operations = [
|
operations = [
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='iprange',
|
model_name='iprange',
|
||||||
name='mark_reserved',
|
name='mark_populated',
|
||||||
field=models.BooleanField(default=False),
|
field=models.BooleanField(default=False),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
@ -407,14 +407,14 @@ class Prefix(ContactsMixin, GetAvailablePrefixesMixin, CachedScopeMixin, Primary
|
|||||||
"""
|
"""
|
||||||
Return all available IPs within this prefix as an IPSet.
|
Return all available IPs within this prefix as an IPSet.
|
||||||
"""
|
"""
|
||||||
# TODO: Add mark_reserved
|
# TODO: Add mark_populated
|
||||||
|
|
||||||
prefix = netaddr.IPSet(self.prefix)
|
prefix = netaddr.IPSet(self.prefix)
|
||||||
child_ips = netaddr.IPSet([
|
child_ips = netaddr.IPSet([
|
||||||
ip.address.ip for ip in self.get_child_ips()
|
ip.address.ip for ip in self.get_child_ips()
|
||||||
])
|
])
|
||||||
child_ranges = netaddr.IPSet([
|
child_ranges = netaddr.IPSet([
|
||||||
iprange.range for iprange in self.get_child_ranges().filter(mark_reserved=True)
|
iprange.range for iprange in self.get_child_ranges().filter(mark_populated=True)
|
||||||
])
|
])
|
||||||
available_ips = prefix - child_ips - child_ranges
|
available_ips = prefix - child_ips - child_ranges
|
||||||
|
|
||||||
@ -523,19 +523,19 @@ class IPRange(ContactsMixin, PrimaryModel):
|
|||||||
null=True,
|
null=True,
|
||||||
help_text=_('The primary function of this range')
|
help_text=_('The primary function of this range')
|
||||||
)
|
)
|
||||||
mark_reserved = models.BooleanField(
|
mark_populated = models.BooleanField(
|
||||||
verbose_name=_('mark reserved'),
|
verbose_name=_('mark populated'),
|
||||||
default=False,
|
default=False,
|
||||||
help_text=_("Prevent the creation of IP addresses within this range")
|
help_text=_("Prevent the creation of IP addresses within this range")
|
||||||
)
|
)
|
||||||
mark_utilized = models.BooleanField(
|
mark_utilized = models.BooleanField(
|
||||||
verbose_name=_('mark utilized'),
|
verbose_name=_('mark utilized'),
|
||||||
default=False,
|
default=False,
|
||||||
help_text=_("Treat as fully utilized")
|
help_text=_("Report space as 100% utilized")
|
||||||
)
|
)
|
||||||
|
|
||||||
clone_fields = (
|
clone_fields = (
|
||||||
'vrf', 'tenant', 'status', 'role', 'description', 'mark_reserved', 'mark_utilized',
|
'vrf', 'tenant', 'status', 'role', 'description', 'mark_populated', 'mark_utilized',
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
@ -672,7 +672,7 @@ class IPRange(ContactsMixin, PrimaryModel):
|
|||||||
"""
|
"""
|
||||||
Return all available IPs within this range as an IPSet.
|
Return all available IPs within this range as an IPSet.
|
||||||
"""
|
"""
|
||||||
if self.mark_reserved:
|
if self.mark_populated:
|
||||||
return netaddr.IPSet()
|
return netaddr.IPSet()
|
||||||
|
|
||||||
range = netaddr.IPRange(self.start_address.ip, self.end_address.ip)
|
range = netaddr.IPRange(self.start_address.ip, self.end_address.ip)
|
||||||
|
@ -268,8 +268,8 @@ class IPRangeTable(TenancyColumnsMixin, NetBoxTable):
|
|||||||
verbose_name=_('Role'),
|
verbose_name=_('Role'),
|
||||||
linkify=True
|
linkify=True
|
||||||
)
|
)
|
||||||
mark_reserved = columns.BooleanColumn(
|
mark_populated = columns.BooleanColumn(
|
||||||
verbose_name=_('Marked Reserved'),
|
verbose_name=_('Marked Populated'),
|
||||||
false_mark=None
|
false_mark=None
|
||||||
)
|
)
|
||||||
mark_utilized = columns.BooleanColumn(
|
mark_utilized = columns.BooleanColumn(
|
||||||
@ -292,7 +292,7 @@ class IPRangeTable(TenancyColumnsMixin, NetBoxTable):
|
|||||||
model = IPRange
|
model = IPRange
|
||||||
fields = (
|
fields = (
|
||||||
'pk', 'id', 'start_address', 'end_address', 'size', 'vrf', 'status', 'role', 'tenant', 'tenant_group',
|
'pk', 'id', 'start_address', 'end_address', 'size', 'vrf', 'status', 'role', 'tenant', 'tenant_group',
|
||||||
'mark_reserved', 'mark_utilized', 'utilization', 'description', 'comments', 'tags', 'created',
|
'mark_populated', 'mark_utilized', 'utilization', 'description', 'comments', 'tags', 'created',
|
||||||
'last_updated',
|
'last_updated',
|
||||||
)
|
)
|
||||||
default_columns = (
|
default_columns = (
|
||||||
|
Loading…
Reference in New Issue
Block a user