mirror of
https://github.com/netbox-community/netbox.git
synced 2026-04-22 16:58:49 +02:00
9627 use ArrayField on VLANGroup for allowed VLANs (#16710)
* 9627 initial commit * 9627 numeric range field * 9627 numeric range field * 9627 numeric range field * 9627 numeric range field * 9627 add stuff for utilization calc * 9627 update views * 9627 fixes * 9627 available_vlans * 9627 available_vlans * 9627 fixes * 9627 bulk import / edit * 9627 test fixes * 9627 test fixes * 9627 update validation * 9627 fix tests * 9627 fix tests * 9627 fix tests * 9627 fix tests * 9627 fix tests * 9627 fix tests * 9627 review changes * 9627 temp vlan_id filter * Clean up labels * Remove annotate_vlan_ranges() from VLANGroupQuerySet * Misc cleanup * Implement contains_vid filter * Serialize VID ranges as integer lists in REST API * Remove default value from vlan_id_ranges * 9627 fix typo in test * Require vlan_id_ranges & set default value * Fix logic for upper range boundaries * Add field to VLANGroup model documentation * Rename vlan_id_ranges to vid_ranges * Fix computation of available VLAN IDs * Clean up migration * Add tests for range utility functions * Clean up add_available_vlans() * Misc cleanup, add test for VID validation --------- Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
This commit is contained in:
@@ -9,7 +9,8 @@ from ipam.models import *
|
||||
from netbox.forms import NetBoxModelImportForm
|
||||
from tenancy.models import Tenant
|
||||
from utilities.forms.fields import (
|
||||
CSVChoiceField, CSVContentTypeField, CSVModelChoiceField, CSVModelMultipleChoiceField, SlugField
|
||||
CSVChoiceField, CSVContentTypeField, CSVModelChoiceField, CSVModelMultipleChoiceField, SlugField,
|
||||
NumericRangeArrayField,
|
||||
)
|
||||
from virtualization.models import VirtualMachine, VMInterface
|
||||
|
||||
@@ -411,22 +412,13 @@ class VLANGroupImportForm(NetBoxModelImportForm):
|
||||
required=False,
|
||||
label=_('Scope type (app & model)')
|
||||
)
|
||||
min_vid = forms.IntegerField(
|
||||
min_value=VLAN_VID_MIN,
|
||||
max_value=VLAN_VID_MAX,
|
||||
required=False,
|
||||
label=_('Minimum child VLAN VID (default: {minimum})').format(minimum=VLAN_VID_MIN)
|
||||
)
|
||||
max_vid = forms.IntegerField(
|
||||
min_value=VLAN_VID_MIN,
|
||||
max_value=VLAN_VID_MAX,
|
||||
required=False,
|
||||
label=_('Maximum child VLAN VID (default: {maximum})').format(maximum=VLAN_VID_MIN)
|
||||
vid_ranges = NumericRangeArrayField(
|
||||
required=False
|
||||
)
|
||||
|
||||
class Meta:
|
||||
model = VLANGroup
|
||||
fields = ('name', 'slug', 'scope_type', 'scope_id', 'min_vid', 'max_vid', 'description', 'tags')
|
||||
fields = ('name', 'slug', 'scope_type', 'scope_id', 'vid_ranges', 'description', 'tags')
|
||||
labels = {
|
||||
'scope_id': 'Scope ID',
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user