mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-14 09:51:22 -06:00
Fixes #6822: Use consistent maximum value for interface MTU
This commit is contained in:
parent
4f6944424b
commit
8355270a1a
@ -12,6 +12,7 @@
|
|||||||
* [#6778](https://github.com/netbox-community/netbox/issues/6778) - Rack reservation should display rack's location
|
* [#6778](https://github.com/netbox-community/netbox/issues/6778) - Rack reservation should display rack's location
|
||||||
* [#6780](https://github.com/netbox-community/netbox/issues/6780) - Include rack location in navigation breadcrumbs
|
* [#6780](https://github.com/netbox-community/netbox/issues/6780) - Include rack location in navigation breadcrumbs
|
||||||
* [#6794](https://github.com/netbox-community/netbox/issues/6794) - Fix device name display on device status view
|
* [#6794](https://github.com/netbox-community/netbox/issues/6794) - Fix device name display on device status view
|
||||||
|
* [#6822](https://github.com/netbox-community/netbox/issues/6822) - Use consistent maximum value for interface MTU
|
||||||
|
|
||||||
### Other Changes
|
### Other Changes
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ REARPORT_POSITIONS_MAX = 1024
|
|||||||
#
|
#
|
||||||
|
|
||||||
INTERFACE_MTU_MIN = 1
|
INTERFACE_MTU_MIN = 1
|
||||||
INTERFACE_MTU_MAX = 32767 # Max value of a signed 16-bit integer
|
INTERFACE_MTU_MAX = 65536
|
||||||
|
|
||||||
VIRTUAL_IFACE_TYPES = [
|
VIRTUAL_IFACE_TYPES = [
|
||||||
InterfaceTypeChoices.TYPE_VIRTUAL,
|
InterfaceTypeChoices.TYPE_VIRTUAL,
|
||||||
|
@ -102,6 +102,12 @@ class InterfaceCommonForm(forms.Form):
|
|||||||
required=False,
|
required=False,
|
||||||
label='MAC address'
|
label='MAC address'
|
||||||
)
|
)
|
||||||
|
mtu = forms.IntegerField(
|
||||||
|
required=False,
|
||||||
|
min_value=INTERFACE_MTU_MIN,
|
||||||
|
max_value=INTERFACE_MTU_MAX,
|
||||||
|
label='MTU'
|
||||||
|
)
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
super().clean()
|
super().clean()
|
||||||
@ -3173,12 +3179,6 @@ class InterfaceCreateForm(ComponentCreateForm, InterfaceCommonForm):
|
|||||||
'type': 'lag',
|
'type': 'lag',
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
mtu = forms.IntegerField(
|
|
||||||
required=False,
|
|
||||||
min_value=INTERFACE_MTU_MIN,
|
|
||||||
max_value=INTERFACE_MTU_MAX,
|
|
||||||
label='MTU'
|
|
||||||
)
|
|
||||||
mac_address = forms.CharField(
|
mac_address = forms.CharField(
|
||||||
required=False,
|
required=False,
|
||||||
label='MAC Address'
|
label='MAC Address'
|
||||||
|
@ -483,7 +483,10 @@ class BaseInterface(models.Model):
|
|||||||
mtu = models.PositiveIntegerField(
|
mtu = models.PositiveIntegerField(
|
||||||
blank=True,
|
blank=True,
|
||||||
null=True,
|
null=True,
|
||||||
validators=[MinValueValidator(1), MaxValueValidator(65536)],
|
validators=[
|
||||||
|
MinValueValidator(INTERFACE_MTU_MIN),
|
||||||
|
MaxValueValidator(INTERFACE_MTU_MAX)
|
||||||
|
],
|
||||||
verbose_name='MTU'
|
verbose_name='MTU'
|
||||||
)
|
)
|
||||||
mode = models.CharField(
|
mode = models.CharField(
|
||||||
|
@ -1464,7 +1464,7 @@ class InterfaceTestCase(ViewTestCases.DeviceComponentViewTestCase):
|
|||||||
'enabled': False,
|
'enabled': False,
|
||||||
'lag': interfaces[3].pk,
|
'lag': interfaces[3].pk,
|
||||||
'mac_address': EUI('01:02:03:04:05:06'),
|
'mac_address': EUI('01:02:03:04:05:06'),
|
||||||
'mtu': 2000,
|
'mtu': 65000,
|
||||||
'mgmt_only': True,
|
'mgmt_only': True,
|
||||||
'description': 'A front port',
|
'description': 'A front port',
|
||||||
'mode': InterfaceModeChoices.MODE_TAGGED,
|
'mode': InterfaceModeChoices.MODE_TAGGED,
|
||||||
|
@ -16,10 +16,10 @@ from ipam.models import IPAddress, VLAN
|
|||||||
from tenancy.forms import TenancyFilterForm, TenancyForm
|
from tenancy.forms import TenancyFilterForm, TenancyForm
|
||||||
from tenancy.models import Tenant
|
from tenancy.models import Tenant
|
||||||
from utilities.forms import (
|
from utilities.forms import (
|
||||||
add_blank_choice, BootstrapMixin, BulkEditForm, BulkEditNullBooleanSelect, BulkRenameForm, CommentField,
|
add_blank_choice, BootstrapMixin, BulkEditNullBooleanSelect, BulkRenameForm, CommentField, ConfirmationForm,
|
||||||
ConfirmationForm, CSVChoiceField, CSVModelChoiceField, CSVModelForm, DynamicModelChoiceField,
|
CSVChoiceField, CSVModelChoiceField, DynamicModelChoiceField, DynamicModelMultipleChoiceField, ExpandableNameField,
|
||||||
DynamicModelMultipleChoiceField, ExpandableNameField, form_from_model, JSONField, SlugField, SmallTextarea,
|
form_from_model, JSONField, SlugField, SmallTextarea, StaticSelect2, StaticSelect2Multiple, TagFilterField,
|
||||||
StaticSelect2, StaticSelect2Multiple, TagFilterField, BOOLEAN_WITH_BLANK_CHOICES,
|
BOOLEAN_WITH_BLANK_CHOICES,
|
||||||
)
|
)
|
||||||
from .choices import *
|
from .choices import *
|
||||||
from .models import Cluster, ClusterGroup, ClusterType, VirtualMachine, VMInterface
|
from .models import Cluster, ClusterGroup, ClusterType, VirtualMachine, VMInterface
|
||||||
@ -680,12 +680,6 @@ class VMInterfaceCreateForm(BootstrapMixin, CustomFieldForm, InterfaceCommonForm
|
|||||||
'virtual_machine_id': '$virtual_machine',
|
'virtual_machine_id': '$virtual_machine',
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
mtu = forms.IntegerField(
|
|
||||||
required=False,
|
|
||||||
min_value=INTERFACE_MTU_MIN,
|
|
||||||
max_value=INTERFACE_MTU_MAX,
|
|
||||||
label='MTU'
|
|
||||||
)
|
|
||||||
mac_address = forms.CharField(
|
mac_address = forms.CharField(
|
||||||
required=False,
|
required=False,
|
||||||
label='MAC Address'
|
label='MAC Address'
|
||||||
|
@ -263,7 +263,7 @@ class VMInterfaceTestCase(ViewTestCases.DeviceComponentViewTestCase):
|
|||||||
'name': 'Interface X',
|
'name': 'Interface X',
|
||||||
'enabled': False,
|
'enabled': False,
|
||||||
'mac_address': EUI('01-02-03-04-05-06'),
|
'mac_address': EUI('01-02-03-04-05-06'),
|
||||||
'mtu': 2000,
|
'mtu': 65000,
|
||||||
'description': 'New description',
|
'description': 'New description',
|
||||||
'mode': InterfaceModeChoices.MODE_TAGGED,
|
'mode': InterfaceModeChoices.MODE_TAGGED,
|
||||||
'untagged_vlan': vlans[0].pk,
|
'untagged_vlan': vlans[0].pk,
|
||||||
|
Loading…
Reference in New Issue
Block a user